My emacs is set up with lsp-mode that works well for TypeScript & JSX using
ts-ls. However, now that I'm exploring deno, lsp-mode incorrectly sets up my deno projects with
ts-ls, and I can't figure out how to tell lsp-mode to initialize the workspace with the deno LSP instead.
My current emacs config utilizes web-mode + lsp-mode:
(use-package web-mode :ensure t :mode (("\\.ts\\'" . web-mode) ("\\.js\\'" . web-mode) ("\\.tsx\\'" . web-mode) ("\\.jsx\\'" . web-mode)) :config (setq web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'")))) (use-package lsp-mode :ensure t :hook (web-mode . lsp) :commands lsp)
I've used a
.dir-locals.el solution before for something that is somewhat similar, by setting the Yarn 2+ TypeScript server to a different path: https://yarnpkg.com/getting-started/editor-sdks#emacs. However, this case is slightly different. I don't need a different server for
ts-ls, I need to initialize the workspace with deno LSP.
What's the best way to set lsp-mode's language server based on a directory? I'd like
ts-ls to be the default, and deno LSP only in specific cases, probably by project directory (since the file extension is the same).