fix root detection for lsp

This commit is contained in:
Thomas Ruoff
2025-09-08 15:28:28 +02:00
parent 7ddfc57eca
commit af3bbcba1b

View File

@@ -205,19 +205,26 @@ return {
root_dir = function(bufnr, cb) root_dir = function(bufnr, cb)
local fname = vim.api.nvim_buf_get_name(bufnr) local fname = vim.api.nvim_buf_get_name(bufnr)
if fname:find 'frontend%-apps/bcr/core/public' then if fname:find 'frontend%-apps/bcr/core/public/src' then
-- yes, so use the core root -- yes, so use the core root
local root = vim.fs.root(fname, { 'apps/core/public/' }) local root = vim.fs.root(fname, { 'core/public/src' })
cb(root) if root then return cb(root) end
elseif fname:find 'frontend%-apps/bcr' then end
if fname:find 'frontend%-apps/bcr' then
-- am I in core? -- am I in core?
local root = vim.fs.root(fname, { 'apps/' }) local root = vim.fs.root(fname, { 'apps/' })
cb(root) if root then return cb(root) end
else
local default_markers = { 'tsconfig.json', 'package.json', 'jsconfig.json', '.git' }
local root = vim.fs.root(fname, default_markers)
cb(root)
end end
if fname:find 'prisma%-design%-system/' then
local root = vim.fs.root(fname, { '.git' })
if root then return cb(root) end
end
local default_markers = { 'tsconfig.json', 'package.json', 'jsconfig.json', '.git' }
local root = vim.fs.root(fname, default_markers)
cb(root)
end, end,
}, },