diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-01-21 11:46:20 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2026-01-21 13:18:02 +0800 |
| commit | a937b54d4f1ea82b605c7e48d3336e0cf64b73ca (patch) | |
| tree | dad1151e26024783d848c09472be4802f21f4f08 | |
| parent | docs: update configs.md (diff) | |
| download | nvim-lspconfig-zeertzjq-patch-1.tar nvim-lspconfig-zeertzjq-patch-1.tar.gz nvim-lspconfig-zeertzjq-patch-1.tar.bz2 nvim-lspconfig-zeertzjq-patch-1.tar.lz nvim-lspconfig-zeertzjq-patch-1.tar.xz nvim-lspconfig-zeertzjq-patch-1.tar.zst nvim-lspconfig-zeertzjq-patch-1.zip | |
fix(lua_ls): adjust prioritieszeertzjq-patch-1
Give same priority for .emmyrc.json and .luarc.json, lower priority to
other config files, and lowest priority to .git.
| -rw-r--r-- | lsp/lua_ls.lua | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lsp/lua_ls.lua b/lsp/lua_ls.lua index 97bb6f5e..7a180ddf 100644 --- a/lsp/lua_ls.lua +++ b/lsp/lua_ls.lua @@ -68,21 +68,25 @@ --- * [Lua.workspace.library](https://luals.github.io/wiki/settings/#workspacelibrary) --- +local root_markers1 = { + '.emmyrc.json', + '.luarc.json', + '.luarc.jsonc', +} +local root_markers2 = { + '.luacheckrc', + '.stylua.toml', + 'stylua.toml', + 'selene.toml', + 'selene.yml', +} + ---@type vim.lsp.Config return { cmd = { 'lua-language-server' }, filetypes = { 'lua' }, - root_markers = { - '.emmyrc.json', - '.luarc.json', - '.luarc.jsonc', - '.luacheckrc', - '.stylua.toml', - 'stylua.toml', - 'selene.toml', - 'selene.yml', - '.git', - }, + root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers1, root_markers2, { '.git' } } + or vim.list_extend(vim.list_extend(root_markers1, root_markers2), { '.git' }), settings = { Lua = { codeLens = { enable = true }, |
