From a937b54d4f1ea82b605c7e48d3336e0cf64b73ca Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 21 Jan 2026 11:46:20 +0800 Subject: fix(lua_ls): adjust priorities Give same priority for .emmyrc.json and .luarc.json, lower priority to other config files, and lowest priority to .git. --- lsp/lua_ls.lua | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'lsp/lua_ls.lua') 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 }, -- cgit v1.2.3-70-g09d2