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)
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
local root = vim.fs.root(fname, { 'apps/core/public/' })
cb(root)
elseif fname:find 'frontend%-apps/bcr' then
local root = vim.fs.root(fname, { 'core/public/src' })
if root then return cb(root) end
end
if fname:find 'frontend%-apps/bcr' then
-- am I in core?
local root = vim.fs.root(fname, { 'apps/' })
cb(root)
else
if root then return 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,
},