There is no good reason to have it as a root marker and it makes the
configuration super convoluted. It breaks on even basic setups: opening
`src/nvim/generators/hashy.lua` in the neovim repo causes `src/nvim` to
be the root since there's a `lua` folder there. Instead, just make the
root a flat set of markers and let users who look for a more advanced
setup to adjust it in their own configurations.
.luarc is created by lua-lsp itself (e.g. if you hit "disable diagnostics" in a code action), at which point the lsp will start showing errors that the vim global is undefined after the next restart.
Problem:
Looking at the code for root dir detection for `lua_ls`:
9bda20fb96/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](9bda20fb96/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
Problem:
The name `server_configurations` is extremely verbose and irritatingly
formal and dogmatic. This overlong name is a constant nuisance when
reading, writing, and coding.
It's also not even correct: these configurations are just as much
"client" configurations as they are "server" configurations.
Solution:
- Rename to a shorter name.
- Leave placeholder files for any old URLs that link to the old
location.