Skip to content
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

diagnosticls and eslint #2

Closed
casperstorm opened this issue Nov 16, 2020 · 14 comments
Closed

diagnosticls and eslint #2

casperstorm opened this issue Nov 16, 2020 · 14 comments

Comments

@casperstorm
Copy link

Hi Rockerboo.
I've been following your dotfiles since you are using prettier, eslint and TS with nvim-lsp, something I've recently tried to migrate to (from coc). I have been following neovim/neovim#12655 to have multiple LSP running. I tried to copy your setup. This is what i currently have: lsp/init.lua.

My problem is that eslint is not showing up. TS LSP is running and working but unsure what I need to do in order for eslint to work. Do you have any suggestions?

If you don't want these questions then I respect if you close this issue.

@rockerBOO
Copy link
Owner

My version is kinda hacky in that it runs yarn eslint which uses the package eslint version. So change the yarn eslint to eslint and install eslint globally.

This is where I got the code from initially: https://www.reddit.com/r/neovim/comments/j2tn38/help_with_integrate_nvimlsp_with_eslint/g79ekv5/

@rockerBOO
Copy link
Owner

Also to note, I sort of dropped it in, to allow me to try it without ALE. There is a bit of polish I would do even initially (tsserver and eslint duplicate simular rules, maybe disabling hints from typescript-language-server)

But this way I can go through diagnostics all in the same interface, get virtual text and so on.

@casperstorm
Copy link
Author

I'll try your suggestion, thanks.

I like it is close to being optimal, but it still feels like a uphill battle to get it running as smoothly as VSCode runs TS with ESLint and Prettier. I've had a pretty good CoC setup for a long time but it just slows my machine down so much. I'll get there eventually. I just thought that this new PR with multiple LSP's was the missing pieces!

It seems you just need to disable hints (errors) from TS LSP, I guess you want those errors/warnings from ESLint based of your project config. It could vary.

@rockerBOO
Copy link
Owner

I would say you can directly blame VSCode/Typescript being the same vendor. We must push against this force though so we can get the support we want. There are various implementation with people not wanting to maintian their typescript language servers. So its more rough because the main vendor has built most of the typescript language server directly into VSCode. CoC has a lot of the same limitations of the typescript LS but it integrates linter/formatting support (i'm sort of guessing, never actually used CoC).

IIRC there may be a proper typescript language server by Microsoft in the future. I'd imagine it would come with yarn/package.json support to detect if you have eslintrc or prettierrc and automatically run it those as well.

So for now I'm just going to try and get diagnosticls to work well with the gaps missing and not try to overlap.

@rockerBOO
Copy link
Owner

See microsoft/TypeScript#39459 for info about the Microsoft TS LS

@casperstorm
Copy link
Author

casperstorm commented Nov 16, 2020

I just tried to spend some more time with it. I am obviously making some kind of mistake, because no matter what I do eslint warnings or errors are not showing. In my head I would love them to show inline like the default lsp errors, but not sure what I need to change, i feel i have similar setup as you do.

Do you wanna take a quick look? I admit I am not the best at the config setup.
Here is the important files:

So its more rough because the main vendor has built most of the typescript language server directly into VSCode.

This sucks, will take a while to get us up to speed, but I agree we must truck on. I did try VSCode with Vim extension but while I love the integration with TS (and Rust, which is the two languages i use professionally) I can't leave my "native" (N)vim.

@rockerBOO
Copy link
Owner

I'm going to take a look a little later tonight. I had it working but now its not working so I'm going to figure out all the eslint/prettier things.

@rockerBOO
Copy link
Owner

Ok I currently have diagnosticls linting and formatting, and tsserver also doing it's things.

2020-11-17-013545_4480x1440_scrot

The issue was the filetypes list needed typescript.tsx which has is from https://github.com/peitalin/vim-jsx-typescript

https://github.com/rockerBOO/dotfiles/blob/master/config/nvim/lua/lsp_config.lua Its mostly the same.

I added an on attach hook for doing the formatting. https://www.reddit.com/r/neovim/comments/jvisg5/lets_talk_formatting_again/ gave the example I am using.

@casperstorm
Copy link
Author

This is great nice. I just got it to work as well. Thanks for posting this to me as well.
Excited to see the development of the whole TS LSP server going forward.

@rockerBOO
Copy link
Owner

For others following along, I have moved to using efm-langserver instead of diagnosticls but still should work. The config is in .config/efm-langserver/config.yaml instead of directly in the lsp config.

@dagadbm
Copy link

dagadbm commented Apr 12, 2021

any reasoning why? is it more performing?

I also have a question, why dont we have an lsp manager plugin to handle all these custom configurations?
I see lspinstall but it stops at efm/diagnosticls and not really support for all the linting/formatting ecosystem..

i dont have the skillls to do this but I was wondering why no one hasnt thought about this before

@rockerBOO
Copy link
Owner

Honestly I was just lazy and efm had a configuration already written on their README. Not sure of the absolute differences (speed, size, updating, toolchain) but it worked more for me.

LSP is pretty new, especially for neovim (isn't even released yet) so "feature-full" plugins will come a little later. Likely packages that will automatically setup specific environments (like typescript + eslint + prettier) will come more in the future. Other languages like rust/go have an inclusive toolchain that everyone uses (rust-analyzer, rustfmt, clippy) (go fmt, go vet) so these are a little easier to have all working with 1 LS.

With the release of neovim 0.5 it will be more likely to have things more mature, without all the growing pains of missing utility. I have a list of the newer neovim plugins for LSP which is growing as the LSP client implementation is getting ready for release.

@dagadbm
Copy link

dagadbm commented Apr 12, 2021 via email

@dagadbm
Copy link

dagadbm commented Apr 12, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants