You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, thanks for the awesome project—it makes configuring LSPs in Neovim so much easier!
Context
I ran into an issue where VSCode correctly picked up the closest ESLint version in my project, but Neovim’s ESLint LSP always used the root directory’s version instead.
After troubleshooting, I found that my inner directory had ESLint ^9.20.1, while the project root had 7.32.0. Neovim defaulted to the root’s version instead of the closest one. I resolved this by tweaking my config:
localfunctionget_eslint_closest_dir()
localcwd=vim.fn.getcwd()
localeslint_node_modules=vim.fn.finddir('node_modules/eslint', cwd..';')
ifeslint_node_modules=='' thenreturnnilendreturneslint_node_modules=='node_modules/eslint' andcwdoreslint_node_modules:match'(.*)/node_modules/eslint'endreturn {
single_file_support=true,
on_new_config=function(config, new_root_dir)
new_root_dir=get_eslint_closest_dir() ornew_root_dir-- (continuing from on_new_config in nvim-lspconfig)
}
It seems like new_root_dir is always set to the project’s root when opening a file.
So I was wondering—does this behavior come from the on_new_config callback, the ESLint LSP itself, or is it something nvim-lspconfig should handle?
Thanks in advance! 😊
The text was updated successfully, but these errors were encountered:
Description
Hi there!
First off, thanks for the awesome project—it makes configuring LSPs in Neovim so much easier!
Context
I ran into an issue where VSCode correctly picked up the closest ESLint version in my project, but Neovim’s ESLint LSP always used the root directory’s version instead.
After troubleshooting, I found that my inner directory had ESLint
^9.20.1
, while the project root had7.32.0
. Neovim defaulted to the root’s version instead of the closest one. I resolved this by tweaking my config:It seems like
new_root_dir
is always set to the project’s root when opening a file.So I was wondering—does this behavior come from the
on_new_config
callback, the ESLint LSP itself, or is it somethingnvim-lspconfig
should handle?Thanks in advance! 😊
The text was updated successfully, but these errors were encountered: