aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/docgen.lua
diff options
context:
space:
mode:
authorPeter Kling <peter.kling@uni-hamburg.de>2024-10-01 16:20:13 +0200
committerGitHub <noreply@github.com>2024-10-01 07:20:13 -0700
commit814f02ed039ec9fce89949aa4306796b4e14daa5 (patch)
tree7eee9406d91c0d56bff5b8ad0e20548e830f6b55 /scripts/docgen.lua
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-814f02ed039ec9fce89949aa4306796b4e14daa5.tar
nvim-lspconfig-814f02ed039ec9fce89949aa4306796b4e14daa5.tar.gz
nvim-lspconfig-814f02ed039ec9fce89949aa4306796b4e14daa5.tar.bz2
nvim-lspconfig-814f02ed039ec9fce89949aa4306796b4e14daa5.tar.lz
nvim-lspconfig-814f02ed039ec9fce89949aa4306796b4e14daa5.tar.xz
nvim-lspconfig-814f02ed039ec9fce89949aa4306796b4e14daa5.tar.zst
nvim-lspconfig-814f02ed039ec9fce89949aa4306796b4e14daa5.zip
fix(lua-language-server): root directory pattern #3322
Problem: Looking at the code for root dir detection for `lua_ls`: https://github.com/neovim/nvim-lspconfig/blob/9bda20fb967075355f253911bc066a8b5a03c77e/lua/lspconfig/server_configurations/lua_ls.lua#L17-L27 I was surprised that finding the git ancestor has lower priority than the `lua/` subdirectories (which, btw, is not mentioned in docs). Consider the following directory structure: HOME/ ├─ workspaces/ │ ├─ lua/ │ ├─ python/ │ ├─ work/ │ │ ├─ SomeProjectWithLuaFiles/ │ │ │ ├─ .git/ The `lua/` and `python/` directories contain some miscellaneous language-specific projects I sometimes work on. The project directory under work/ also contains some lua files. I expected the `.git` directory in the project to ensure that the project root dir is correctly detected to be `…/SomeProjectWithLuaFiles`. But since the [search for the `lua/` subdirectory](https://github.com/neovim/nvim-lspconfig/blob/9bda20fb967075355f253911bc066a8b5a03c77e/lua/lspconfig/server_configurations/lua_ls.lua#L22) is done first, my LSP detects `HOME/workspaces/` as the root directory. Solution: Search for the git ancestor before looking for the `lua/` subdirectory. Return the longer root path if both a `.git/` and a `lua/` ancestor are found. Fixes #3165
Diffstat (limited to 'scripts/docgen.lua')
0 files changed, 0 insertions, 0 deletions