aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-01-21 11:46:20 +0800
committerzeertzjq <zeertzjq@outlook.com>2026-01-21 13:18:02 +0800
commita937b54d4f1ea82b605c7e48d3336e0cf64b73ca (patch)
treedad1151e26024783d848c09472be4802f21f4f08
parentdocs: update configs.md (diff)
downloadnvim-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.lua26
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 },