nvimtools / none-ls.nvim

null-ls.nvim reloaded / Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
The Unlicense
2.39k stars 69 forks source link

Support monorepo projects with pnpm #143

Closed towry closed 1 month ago

towry commented 2 months ago

Issues

Feature description

In monorepo, the eslint is installed at the root node_modules by pnpm.

In code https://github.com/nvimtools/none-ls.nvim/blob/8691504118b252d64fc5023a104aedd100ab754a/lua/null-ls/helpers/command_resolver.lua#L40

The u.get_root() will cause the searching only traverse up to the sub package's root if the nvim user are using some project manage plugin.

For example:

-- monorepo
  - node_modules
  - packages
     - foo-package
       - index.js
       - node_modules

If we are edit the index.js in foo-package, the vim.uv.cwd() will be monorepo/packages/foo-package, but the eslint are in monorepo/node_modules/.bin because of pnpm.

So u.get_root() returns monorepo/packages/foo-package and in https://github.com/nvimtools/none-ls.nvim/blob/8691504118b252d64fc5023a104aedd100ab754a/lua/null-ls/helpers/command_resolver.lua#L11 the search will be stopped immediately.

Help

Yes

Implementation help

I suggest add an option to change the end_path when searching for command executable. for example, config.get_search_root_stop_path