0

I have set up tree-sitter and typescript-ts-mode.

But if I activate eglot using M-x eglot it complains that it can't find the typescript-language-server executable – well duh, I didn't install it globally ... :-)

The question is, what's the recommended way to make it realize that the current tsconfig.json actually has a typescript-eslint-language-service plugin defined and that it should use the locally installed typescript-language-server.

Something that goes into .dir-locals.el – ?

1 Answer 1

1

I am not familiar with typescript (or javascript), but I think generally a language server should be installed globally, and the server should be configured for the project. I guess the typescript-language-server will automatically determine the project by looking for the tsconfig.json, and use its configuration (just guessing, if not, then find out how to configure it).

Eglot uses the emacs built-in 'project.el' for determining the project root. So if you are already using some supported VC (see vc-handled-backends) or EDE this part will be fine. Otherwise, you should configure eglot to find the right project root by adding tsconfig.json to the project-vc-extra-root-markers:

(add-to-list 'project-vc-extra-root-markers "tsconfig.json")

Finally, Emacs uses typescript-language-server by default for js-mode, js-ts-mode, tsx-ts-mode, typescript-ts-mode and typescript-mode (see eglot-server-programs), so that you can just start eglot without further configuration.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.