Skip to content

Commit

Permalink
Merge pull request #500 from jtsiros/master
Browse files Browse the repository at this point in the history
Fix Emacs configuration for Doom Emacs compatibility
  • Loading branch information
DanielGavin authored Sep 5, 2024
2 parents 7c4f71d + 061aedf commit 4102eff
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down

0 comments on commit 4102eff

Please sign in to comment.