Hopefully the fix *crosses fingers*
This commit is contained in:
@@ -1,24 +1,12 @@
|
|||||||
-- LSP Configuration
|
-- LSP server configurations
|
||||||
-- Extends LazyVim's built-in LSP support
|
-- Extends LazyVim's nvim-lspconfig setup via opts.servers.
|
||||||
|
--
|
||||||
-- Root detection: nearest project marker, falling back to git root.
|
-- Uses `root_markers` (Neovim 0.11+ vim.lsp.config API) instead of a custom
|
||||||
-- The require is inside the returned function so lspconfig.util is loaded
|
-- root_dir function. root_markers is a list of filenames that, when found
|
||||||
-- lazily at attach time, not at module load.
|
-- walking upward from the buffer, identify the workspace root. `.git` is
|
||||||
local function make_root_detector(markers)
|
-- always listed last as a fallback.
|
||||||
return function(fname)
|
|
||||||
local util = require("lspconfig.util")
|
|
||||||
-- First try language-specific markers (nearest to file)
|
|
||||||
local root = util.root_pattern(unpack(markers))(fname)
|
|
||||||
if root then
|
|
||||||
return root
|
|
||||||
end
|
|
||||||
-- Fallback to git root
|
|
||||||
return util.root_pattern(".git")(fname)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- LSP configuration
|
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
opts = {
|
opts = {
|
||||||
@@ -27,7 +15,7 @@ return {
|
|||||||
-- Go
|
-- Go
|
||||||
-- ─────────────────────────────────────────────────────────────────
|
-- ─────────────────────────────────────────────────────────────────
|
||||||
gopls = {
|
gopls = {
|
||||||
root_dir = make_root_detector({ "go.work", "go.mod" }),
|
root_markers = { "go.work", "go.mod", ".git" },
|
||||||
settings = {
|
settings = {
|
||||||
gopls = {
|
gopls = {
|
||||||
gofumpt = true,
|
gofumpt = true,
|
||||||
@@ -73,7 +61,7 @@ return {
|
|||||||
-- Lua
|
-- Lua
|
||||||
-- ─────────────────────────────────────────────────────────────────
|
-- ─────────────────────────────────────────────────────────────────
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
root_dir = make_root_detector({
|
root_markers = {
|
||||||
".luarc.json",
|
".luarc.json",
|
||||||
".luarc.jsonc",
|
".luarc.jsonc",
|
||||||
".luacheckrc",
|
".luacheckrc",
|
||||||
@@ -81,7 +69,8 @@ return {
|
|||||||
"stylua.toml",
|
"stylua.toml",
|
||||||
"selene.toml",
|
"selene.toml",
|
||||||
"selene.yml",
|
"selene.yml",
|
||||||
}),
|
".git",
|
||||||
|
},
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
workspace = { checkThirdParty = false },
|
workspace = { checkThirdParty = false },
|
||||||
@@ -95,7 +84,7 @@ return {
|
|||||||
-- TypeScript / JavaScript
|
-- TypeScript / JavaScript
|
||||||
-- ─────────────────────────────────────────────────────────────────
|
-- ─────────────────────────────────────────────────────────────────
|
||||||
ts_ls = {
|
ts_ls = {
|
||||||
root_dir = make_root_detector({ "tsconfig.json", "jsconfig.json", "package.json" }),
|
root_markers = { "tsconfig.json", "jsconfig.json", "package.json", ".git" },
|
||||||
settings = {
|
settings = {
|
||||||
typescript = {
|
typescript = {
|
||||||
inlayHints = {
|
inlayHints = {
|
||||||
@@ -126,20 +115,20 @@ return {
|
|||||||
-- Web (HTML / CSS / JSON / YAML)
|
-- Web (HTML / CSS / JSON / YAML)
|
||||||
-- ─────────────────────────────────────────────────────────────────
|
-- ─────────────────────────────────────────────────────────────────
|
||||||
html = {
|
html = {
|
||||||
root_dir = make_root_detector({ "package.json", ".git" }),
|
root_markers = { "package.json", ".git" },
|
||||||
filetypes = { "html", "templ" },
|
filetypes = { "html", "templ" },
|
||||||
},
|
},
|
||||||
|
|
||||||
cssls = {
|
cssls = {
|
||||||
root_dir = make_root_detector({ "package.json", ".git" }),
|
root_markers = { "package.json", ".git" },
|
||||||
},
|
},
|
||||||
|
|
||||||
jsonls = {
|
jsonls = {
|
||||||
root_dir = make_root_detector({ "package.json", ".git" }),
|
root_markers = { "package.json", ".git" },
|
||||||
},
|
},
|
||||||
|
|
||||||
yamlls = {
|
yamlls = {
|
||||||
root_dir = make_root_detector({ "package.json", ".git" }),
|
root_markers = { "package.json", ".git" },
|
||||||
settings = {
|
settings = {
|
||||||
yaml = {
|
yaml = {
|
||||||
keyOrdering = false,
|
keyOrdering = false,
|
||||||
@@ -155,11 +144,11 @@ return {
|
|||||||
-- Markdown / SQL / Docker
|
-- Markdown / SQL / Docker
|
||||||
-- ─────────────────────────────────────────────────────────────────
|
-- ─────────────────────────────────────────────────────────────────
|
||||||
marksman = {
|
marksman = {
|
||||||
root_dir = make_root_detector({ ".marksman.toml", ".git" }),
|
root_markers = { ".marksman.toml", ".git" },
|
||||||
},
|
},
|
||||||
|
|
||||||
sqlls = {
|
sqlls = {
|
||||||
root_dir = make_root_detector({ ".sqllsrc.json", "sqlls.json", ".git" }),
|
root_markers = { ".sqllsrc.json", "sqlls.json", ".git" },
|
||||||
},
|
},
|
||||||
|
|
||||||
dockerls = {},
|
dockerls = {},
|
||||||
|
|||||||
Reference in New Issue
Block a user