aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lsp/biome.lua9
-rw-r--r--lsp/eslint.lua9
-rw-r--r--lsp/svelte.lua8
-rw-r--r--lsp/ts_ls.lua9
-rw-r--r--lsp/tsgo.lua9
-rw-r--r--lsp/vtsls.lua9
6 files changed, 26 insertions, 27 deletions
diff --git a/lsp/biome.lua b/lsp/biome.lua
index b3d2100d..bb6e1b00 100644
--- a/lsp/biome.lua
+++ b/lsp/biome.lua
@@ -46,11 +46,10 @@ return {
-- manager lock file.
local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock', 'deno.lock' }
-- 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 } or root_markers
- local project_root = vim.fs.root(bufnr, root_markers)
- if not project_root then
- return
- end
+ root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
+ or vim.list_extend(root_markers, { '.git' })
+ -- 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()
-- We know that the buffer is using Biome if it has a config file
-- in its directory tree.
diff --git a/lsp/eslint.lua b/lsp/eslint.lua
index 5e6cb1d4..2605c3e9 100644
--- a/lsp/eslint.lua
+++ b/lsp/eslint.lua
@@ -93,11 +93,10 @@ return {
-- manager lock file.
local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock', 'deno.lock' }
-- 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 } or root_markers
- local project_root = vim.fs.root(bufnr, root_markers)
- if not project_root then
- return
- end
+ root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
+ or vim.list_extend(root_markers, { '.git' })
+ -- 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()
-- We know that the buffer is using ESLint if it has a config file
-- in its directory tree.
diff --git a/lsp/svelte.lua b/lsp/svelte.lua
index e7177991..53f3e73e 100644
--- a/lsp/svelte.lua
+++ b/lsp/svelte.lua
@@ -14,11 +14,15 @@ return {
cmd = { 'svelteserver', '--stdio' },
filetypes = { 'svelte' },
root_dir = function(bufnr, on_dir)
- local root_files = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock', 'deno.lock' }
local fname = vim.api.nvim_buf_get_name(bufnr)
-- Svelte LSP only supports file:// schema. https://github.com/sveltejs/language-tools/issues/2777
if vim.uv.fs_stat(fname) ~= nil then
- on_dir(vim.fs.dirname(vim.fs.find(root_files, { path = fname, upward = true })[1]))
+ local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock', 'deno.lock' }
+ root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
+ or vim.list_extend(root_markers, { '.git' })
+ -- 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()
+ on_dir(project_root)
end
end,
on_attach = function(client, bufnr)
diff --git a/lsp/ts_ls.lua b/lsp/ts_ls.lua
index a0ae150f..773716ac 100644
--- a/lsp/ts_ls.lua
+++ b/lsp/ts_ls.lua
@@ -60,11 +60,10 @@ return {
-- manager lock file.
local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock', 'deno.lock' }
-- 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 } or root_markers
- local project_root = vim.fs.root(bufnr, root_markers)
- if not project_root then
- return
- end
+ root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
+ or vim.list_extend(root_markers, { '.git' })
+ -- 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()
on_dir(project_root)
end,
diff --git a/lsp/tsgo.lua b/lsp/tsgo.lua
index 3b26ad10..3ef9a921 100644
--- a/lsp/tsgo.lua
+++ b/lsp/tsgo.lua
@@ -32,11 +32,10 @@ return {
-- manager lock file.
local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock', 'deno.lock' }
-- 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 } or root_markers
- local project_root = vim.fs.root(bufnr, root_markers)
- if not project_root then
- return
- end
+ root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
+ or vim.list_extend(root_markers, { '.git' })
+ -- 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()
on_dir(project_root)
end,
diff --git a/lsp/vtsls.lua b/lsp/vtsls.lua
index ba2e7de5..c8ab993a 100644
--- a/lsp/vtsls.lua
+++ b/lsp/vtsls.lua
@@ -86,11 +86,10 @@ return {
-- manager lock file.
local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock', 'deno.lock' }
-- 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 } or root_markers
- local project_root = vim.fs.root(bufnr, root_markers)
- if not project_root then
- return
- end
+ root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
+ or vim.list_extend(root_markers, { '.git' })
+ -- 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()
on_dir(project_root)
end,