Dealing with Both Deno and Node Projects #999
yvesnrb
started this conversation in
Show and tell
Replies: 2 comments 1 reply
-
I think nowadays you can further simplify your recipe: from the NEWS of the unreleased upcoming version of Eglot:
|
Beta Was this translation helpful? Give feedback.
1 reply
-
I just wanted to add this for documentation since this thread helped me figure out how to deal with having both nodejs and deno projects having their respective lsp servers. Without checking if the project is a deno or nodejs project I added an alternative lsp server for the typescript-ts-mode. So when one is not available use the alternative. This solution also works for me in monorepo's as well. (with-eval-after-load 'eglot
(add-to-list
'eglot-server-programs
`(typescript-ts-mode . ,(eglot-alternatives
'(("typescript-language-server" "--stdio")
("deno" "lsp")))))) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you work with both Deno and Node projects, you'll need to use either the
typescript-language-server
or thedeno lsp
with thejs-mode
andtypescript-mode
major modes depending on your project. Here is a pain free way to manage this usingproject.el
:First, configure the Deno language server:
Define a couple functions to determine the type of the current project:
Define a function to determine the correct CONTACT for buffers of
js-mode
andtypescript-mode
:Notice that it defaults to
nil
if the project has neither apackage.json
or adeno.json
file. I prefer to not have any LSP when I'm editing free floating JS/TS files. Customize to taste.Add this function to the
eglot-server-programs
list:Beta Was this translation helpful? Give feedback.
All reactions