doomemacs/modules/tools/lsp/demos.org
Henrik Lissner be7ac25a84
fix: file-name-concat paths instead of concat
Treat paths as paths, rather than strings. Removes the requirements that
doom-*-dir variables end in slash (though I'll continue doing so as a
convention). Also moves a lot of cache/data into the current profile's
cache/data directories. Shouldn't actually affect anything for folks not
using Doom's profile system (yet).

Fix: #8616
2025-12-30 22:59:10 -05:00

1.7 KiB

:tools lsp API demos

set-eglot-client!

;; For setting a single server command:
(set-eglot-client! 'python-mode
  `(,(file-name-concat doom-profile-data-dir \"lsp/mspyls/Microsoft.Python.LanguageServer\")))

;; This is equivalent to
(with-eval-after-load 'eglot
  (add-to-list 'eglot-server-programs `(python-mode . (,(file-name-concat doom-profile-data-dir "lsp/mspyls/Microsoft.Python.LanguageServer\")))))
(set-eglot-client! '(python-mode python-ts-mode)
                   "pylsp" "pyls"
                   '("basedpyright" "--stdio")
                   '("basedpyright-langserver" "--stdio")
                   '("pyright" "--stdio")
                   '("pyright-langserver" "--stdio")
                   '("pyrefly" "lsp")
                   "jedi-language-server"
                   '("ruff" "server")
                   "ruff-lsp")

;; This is equivalent to
(with-eval-after-load 'eglot
  (add-to-list 'eglot-server-programs
               `(python-mode
                 . ,(eglot-alternatives '("pylsp" "pyls"
                                          ("basedpyright" "--stdio")
                                          ("basedpyright-langserver" "--stdio")
                                          ("pyright" "--stdio")
                                          ("pyright-langserver" "--stdio")
                                          ("pyrefly" "lsp")
                                          "jedi-language-server"
                                          ("ruff" "server")
                                          "ruff-lsp"))))))