diff options
| author | jtsiros <jon@brightblock.ai> | 2024-09-05 14:22:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-05 14:22:47 -0500 |
| commit | 061aedf9b88176d2257631cff1be86bbeeb3370d (patch) | |
| tree | 2fbc7870f4bf59e6dd2e4fddc31b52b3455ca9a0 /README.md | |
| parent | 7c4f71d60fa71d608fc2d355e8ac9f92cdc797f0 (diff) | |
update emacs config
updating the emacs config to work with doom emacs. The way the config is currently defined, it could possibly show an error: (void-variable lsp-language-id-configuration) due to this running before lsp-mode is loaded.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -214,14 +214,22 @@ lspconfig.ols.setup({}) ### Emacs ```elisp -;; With odin-mode (https://github.com/mattt-b/odin-mode) and lsp-mode already added to your init.el of course!. -(setq-default lsp-auto-guess-root t) ;; if you work with Projectile/project.el this will help find the ols.json file. -(defvar lsp-language-id-configuration '((odin-mode . "odin"))) -(lsp-register-client - (make-lsp-client :new-connection (lsp-stdio-connection "/path/to/ols/executable") - :major-modes '(odin-mode) - :server-id 'ols - :multi-root t)) ;; This is just so lsp-mode sends the "workspaceFolders" param to the server. +;; Enable odin-mode and configure OLS as the language server +(use-package! odin-mode + :mode ("\\.odin\\'" . odin-mode) + :hook (odin-mode . lsp)) + +;; Set up OLS as the language server for Odin, ensuring lsp-mode is loaded first +(with-eval-after-load 'lsp-mode + (setq-default lsp-auto-guess-root t) ;; Helps find the ols.json file with Projectile or project.el + (setq lsp-language-id-configuration (cons '(odin-mode . "odin") lsp-language-id-configuration)) + + (lsp-register-client + (make-lsp-client :new-connection (lsp-stdio-connection "/path/to/ols/executable") ;; Adjust the path here + :major-modes '(odin-mode) + :server-id 'ols + :multi-root t))) ;; Ensures lsp-mode sends "workspaceFolders" to the server + (add-hook 'odin-mode-hook #'lsp) ``` |