-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vscode-eslint-language-server not working #976
Comments
That's correct. It's currently impossible in Eglot.
For what it's worth, I used to program a lot of JS/TS until recently and I used a language server and a separate eslint Flymake backend. https://github.com/orzechowskid/flymake-eslint To manually configure other Flymake backends alongside Eglot's LSP-based backend, refer to the Flymake documentation and make sure you add |
As to the rest of your issue, it could be the server has a bug, which is it doesn't respond well to null "workspace configurations". I can't confirm right now, but I don't know if responding with
Regardless, Eglot just doesn't have anything to provide to the server. So if you want it to, please read up on On a side note, I don't understand why all these language servers don't assume sensible defaults when presented with no information. That's what "defaults" are for. I guess the VScode folks like to WETWET (write everything twice, waste everyone's time) A probable sensible default for
|
First of all, thanks for the fast response!
I actually didn't know about this at all. On first sight, this seems like a suitable replacement. I'll check it out! I'll report back. Thanks. |
However, I think it's still worth setting up Let's see how far I can get configuring P.S.: But then again, this only really makes sense once it's possible to run multiple language servers. This is feature planned for the foreseeable future @joaotavora ? |
Hi @joaotavora , I'm not sure if this is the best place to start the discussion again. I think allowing multiple language servers in the same buffer is essential for the "frontend" development flow. The For comparison, vscode supports this out of the box, I was hoping that I can switch to eglot since it is now in the emacs core, and I really hope that this feature I use every day can be implemented in eglot, thanks 🙏 |
I'd like to second @merrickluo's comment above. I'm really excited that eglot is in Emacs core now, and it seems really fast and integrates well with built-in emacs features. But I just can't use it because I need both the typescript and eslint servers. The eslint server isn't just for highlighting errors; it's also for fixing those issues from a menu of options. By running both servers it all works seamlessly, with a consistent UX for identifying and fixing issues wherever the source (typescript or eslint). My concern is that if this is not addressed in eglot, and since eglot is in emacs core now, Emacs will be perceived as a second class LSP citizen for a huge swath of LSP users. |
I just want to say here that multi-server support is indeed number one on my Eglot/LSP/OSS todo list right now. But life keeps getting in the way, unfortunately. Let's see maybe over the holidays i can get something rolling. |
was trying to solve the same problem and saw ts lang server supports plug-ins. Configured the eslint and gql plugins in my tsconfig, but this makes no difference? https://www.typescriptlang.org/tsconfig#plugins |
hey thanks for the flymake-eslint tip. It works good. edit: i was calling eglot multiple times on accident, creating chaos. |
I had slightly better luck using this approach: https://notes.alexkehayias.com/setting-up-typescript-and-eslint-with-eglot/ Pretty invasive though, and eslint code actions / fixes weren't working. Anyone else have any luck with typescript language server plugins? |
HAHAHA this is unexpectedly informative reply, thanks. By the way...
|
Yeah it's getting closer. The ability to auto-fix lint errors is pretty important to me though for FE dev. For some reason, when using the eslint plugin as described above, eglot will show the errors but According to this page you can configure vscode to use a plugin without having to modify your project's
Maybe there's a way to get eglot to support that as well. Still need auto-fix though. |
followed the steps and I think I got lang server with the eslint plugin working. I see now the code action "remove unused imports" which I'm pretty sure is eslint feature. |
I'm struggling with the same problem here, specifically Eslint code actions not available in Eglot. I'm gonna come with a slightly different idea: Thoughts? |
Until I find time to get some multi-server support going, the best way I know of is to use a language server that does this coalescing of various sources itself. To make a generic server joiner for any language, but I must admit it's harder than I thought. Every server combination must be clearly understood, what notifications go where, how to communicate with this beast, what to do when one of the subservers times out, etc, etc. Where to send requests? Both servers and merge responses? What about specific requests like It's easier when these decisions are taken by a single server already existing (like the Alternatively, maybe someone make this server joiner just for the
That doesn't work, can never work cleanly. Flymake works independently with Eglot as one of its backends. Inverting that relation for something Flymake wasn't designed is madness. Flymake diagnostics can however have clickable buttons that run arbitrary functions, but you'd be repeating a lot of the logic Eglot has for code actions, and bumping into the same problems, and they would never be available through |
Thanks for the quick response @joaotavora! Perhaps I'll take a look at the specific case of TypeScript + Eslint as some kind of server joiner. I haven't had any success using Makes sense about the flymake stuff, it was a weird idea I thought perhaps could be easier than running eslint multiple times (once for language server, once for flymake eslint). As I said, I have not read much about the internals of eglot and flymake. |
This is keeping me from fully switching from
With Svelte, as another example, you could easily have a combo of Svelte + ESLint + Tailwind language servers for a Being able to "compose" language servers in an arbitrary way seems very useful in this ecosystem. Unfortunately, I see the complexity in your questions and the need for configurability, @joaotavora. And |
Just came here to say that sure eslint integration for typescript would be nice but my current blocker is with tailwindcss lsp server running in the same buffer as typescript lsp |
Adding to @ovistoica, the use case for multiple LSP servers per buffer goes beyond JavaScript / TypeScript. For instance, in Python it's common to want to use ruff-lsp together with a core Python LSP server like Pyright, which is preferable to integration via Flymake for the same reasons (e.g., code actions). @joaotavora Perhaps sensible answers to the tricky questions can be found in the LSP implementation of Neovim, which has quite seamless multi-server support. From a first glance at the docs, it seems like most LSP requests are indeed sent to all servers, but it's possible to turn off particular capabilities for particular servers. (The official nvim-lspconfig repo has such configurations for dozens of LSP servers, so this configuration is nothing a Neovim user has to deal with usually.) Another inspiration could be |
According to one reader here, not extremely well. #976 (comment) But OK. I guess it's a source.
It would be helpful if someone could dig beyond the "first glance" and really investigate down to the details, with practical scenarios. Are "rename" requests really sent to all servers? Or are these the exception in your "most"? And if they are sent to all servers, are some of the responses ignored. Which one is? Ideally some Nvim or |
I‘m not sure whether I‘ll have time for creating proper traces, but regarding the rename question: yup, seems like Neovim sends the request to every attached server that advertises the capability. While I cannot say I know, I strongly suspect that this is Neovim‘s general approach for all LSP commands: 1.Filter servers by which one advertises the capability Sometimes, this is not ideal (see link above). But it works surprisingly well for the server combinations one would realistically have, as e.g. the ESLint server will most likely not advertise support for renames, for instance. |
I agree with @denisw If eglot exposed a configuration option to filter what server receives the specific event, that would be enough to have a good experience. I'm not sure what this entails, but I cannot use eglot on Javascript/web buffers currently because of the lack of multi-server support. |
#1429 is now the place to talk about this. |
Hello.
This is a 2-in-1 issue report, but since there have been open issue regarding the first one, I thought it's unnecessary to create a new one again.
typescript-language-server
(link) alongside thevscode-eslint-language-server
(link). There already are issues regarding this:After reading through the issues, I was under the impression that this could be done using
eglot-alternatives
, so I added this to my configuration:But I think I may have misunderstood it. It doesn't establish connections to all language servers, but only the first one it can execute. Is it therefore not possible to run multiple language servers at once for a given mode? In the javascript eco system this is kind of needed as
typescript-language-server
only reports syntax / type errors and so one whereasvscode-eslint-language-server
reports errors in regards to the local/global eslint configuration. We need both language servers at once.vscode-eslint-language-server
alone to test it. So I addedto my config.
I have the
eslint
binary itself installed globally. So I init a test project with create-react-app, thencd
into it and runeslint --init
. I answer the question and end up with basic.eslint.js
config file.When loading the test project in emacs, I see two warnings in the Messages buffer:
The connection seem to be established, but nothing is working as I expect it. If I try to execute
eglot-code-actions
I getLooking through eglot's event log, I see (full log below):
This is the line it fails. So I'm not quite sure what to make of this as I'm not experienced with language servers. It seems like
connection.workspace.getConfiguration
on line 117 is not returning a proper configuration.Now is this an internal problem with the eslint language server or something that eglot should provide but doesn't?
I'd love to get some input on these two issues. Thanks in advance!
typescript-language-server
,vscode-eslint-language-server
29.0.50
1.8
LSP transcript - M-x eglot-events-buffer (mandatory unless Emacs inoperable)
Minimum Reproducible Example (mandatory)
vscode-eslint-language-server
:npm i -g vscode-langservers-extracted
PATH
which vscode-eslint-language-server
npx create-react-app my-app
/path/to/my-app/src/App.js
in Emacsvscode-eslint-language-server
connection should be establishedThe text was updated successfully, but these errors were encountered: