diff options
| author | Xubai Wang <18016038327@189.cn> | 2025-11-14 11:07:43 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-13 19:07:43 -0800 |
| commit | 2d4ece4add76ea4fc3792e9425c62b3e66852d99 (patch) | |
| tree | 52749f78737f7ad04080705cd624c17937e7b40e /lsp | |
| parent | docs: update configs.md (diff) | |
| download | nvim-lspconfig-2d4ece4add76ea4fc3792e9425c62b3e66852d99.tar nvim-lspconfig-2d4ece4add76ea4fc3792e9425c62b3e66852d99.tar.gz nvim-lspconfig-2d4ece4add76ea4fc3792e9425c62b3e66852d99.tar.bz2 nvim-lspconfig-2d4ece4add76ea4fc3792e9425c62b3e66852d99.tar.lz nvim-lspconfig-2d4ece4add76ea4fc3792e9425c62b3e66852d99.tar.xz nvim-lspconfig-2d4ece4add76ea4fc3792e9425c62b3e66852d99.tar.zst nvim-lspconfig-2d4ece4add76ea4fc3792e9425c62b3e66852d99.zip | |
fix: exclude deno from biome/eslint/ts_ls/tsgo/vtsls #4130
Close https://github.com/neovim/nvim-lspconfig/issues/4129
Since cwd is a necessity for many JavaScript project (see discussions in https://github.com/neovim/nvim-lspconfig/issues/4015), this fix takes an alternative approach to manually exclude Deno projects from biome/eslint/ts_ls/tsgo/vtsls 's `root_dir` detection logic. There is no need to change svelte since it has a different filetype.
Diffstat (limited to 'lsp')
| -rw-r--r-- | lsp/biome.lua | 6 | ||||
| -rw-r--r-- | lsp/eslint.lua | 6 | ||||
| -rw-r--r-- | lsp/ts_ls.lua | 6 | ||||
| -rw-r--r-- | lsp/tsgo.lua | 6 | ||||
| -rw-r--r-- | lsp/vtsls.lua | 6 |
5 files changed, 30 insertions, 0 deletions
diff --git a/lsp/biome.lua b/lsp/biome.lua index a1343472..d8d569d1 100644 --- a/lsp/biome.lua +++ b/lsp/biome.lua @@ -48,6 +48,12 @@ return { -- Give the root markers equal priority by wrapping them in a table root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } or vim.list_extend(root_markers, { '.git' }) + + -- exclude deno + if vim.fs.root(bufnr, { 'deno.json', 'deno.lock' }) then + return + end + -- We fallback to the current working directory if no project root is found local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() diff --git a/lsp/eslint.lua b/lsp/eslint.lua index 24fac5c3..c200adc1 100644 --- a/lsp/eslint.lua +++ b/lsp/eslint.lua @@ -95,6 +95,12 @@ return { -- Give the root markers equal priority by wrapping them in a table root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } or vim.list_extend(root_markers, { '.git' }) + + -- exclude deno + if vim.fs.root(bufnr, { 'deno.json', 'deno.lock' }) then + return + end + -- We fallback to the current working directory if no project root is found local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() diff --git a/lsp/ts_ls.lua b/lsp/ts_ls.lua index 0b5a0a3c..a47039e6 100644 --- a/lsp/ts_ls.lua +++ b/lsp/ts_ls.lua @@ -62,6 +62,12 @@ return { -- Give the root markers equal priority by wrapping them in a table root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } or vim.list_extend(root_markers, { '.git' }) + + -- exclude deno + if vim.fs.root(bufnr, { 'deno.json', 'deno.lock' }) then + return + end + -- We fallback to the current working directory if no project root is found local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() diff --git a/lsp/tsgo.lua b/lsp/tsgo.lua index b99c731f..cf879137 100644 --- a/lsp/tsgo.lua +++ b/lsp/tsgo.lua @@ -34,6 +34,12 @@ return { -- Give the root markers equal priority by wrapping them in a table root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } or vim.list_extend(root_markers, { '.git' }) + + -- exclude deno + if vim.fs.root(bufnr, { 'deno.json', 'deno.lock' }) then + return + end + -- We fallback to the current working directory if no project root is found local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() diff --git a/lsp/vtsls.lua b/lsp/vtsls.lua index 1265681d..be1f0dfc 100644 --- a/lsp/vtsls.lua +++ b/lsp/vtsls.lua @@ -88,6 +88,12 @@ return { -- Give the root markers equal priority by wrapping them in a table root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } or vim.list_extend(root_markers, { '.git' }) + + -- exclude deno + if vim.fs.root(bufnr, { 'deno.json', 'deno.lock' }) then + return + end + -- We fallback to the current working directory if no project root is found local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() |
