Files
nvim-config/lua/configs/lspconfig.lua
T
naps62andClaude Opus 5 98dc1ba7f2 fix(lsp): drop hand-rolled biome config
root_dir was computed once, at startup, against whatever buffer happened
to be current — freezing one path for the session and breaking
lspconfig's local-binary lookup, which reads config.root_dir.

Everything overridden here is already handled better upstream: cmd
prefers the project-local biome, root_dir is monorepo-aware and resolved
per buffer, the filetypes list is wider, and the server only attaches
where a biome config applies. Only the formatting opt-out stays, since
conform owns that.

Also adds virtual_lines for the line under the cursor, which pairs with
the existing virtual_text = false.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 13:00:47 +00:00

133 lines
3.4 KiB
Lua

local M = {}
local nvlsp = require "nvchad.configs.lspconfig"
local map = vim.keymap.set
M.defaults = function()
-- load defaults i.e lua_lsp
require("nvchad.configs.lspconfig").defaults()
vim.lsp.inlay_hint.enable()
-- lspconfig's own biome config already prefers the project-local binary, detects
-- monorepo roots per buffer, and only attaches where a biome config applies.
-- Formatting is the one thing overridden here: conform owns it.
vim.lsp.config("biome", {
on_attach = function(client)
client.server_capabilities.documentFormattingProvider = false
end,
})
vim.lsp.enable "biome"
vim.lsp.config("lua_ls", {
on_attach = M.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
})
vim.lsp.enable "lua_ls"
vim.lsp.config("solidity_ls_nomicfoundation", {
on_attach = M.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
})
vim.lsp.enable "solidity_ls_nomicfoundation"
vim.diagnostic.config {
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.HINT] = "",
[vim.diagnostic.severity.INFO] = "",
},
},
update_in_insert = false,
underline = true,
severity_sort = true,
virtual_text = false,
virtual_lines = { current_line = true },
float = {
focusable = false,
style = "minimal",
border = "single",
header = "",
prefix = "",
suffix = "",
},
}
end
M.on_attach = function(client, bufnr)
nvlsp.on_attach(client, bufnr)
local function opts(desc)
return { buffer = bufnr, desc = "LSP " .. desc }
end
map("n", "gd", function()
require("fzf-lua").lsp_definitions()
end, opts "LSP Definitions")
map("n", "gv", function()
require("fzf-lua").lsp_definitions { jump1_action = require("fzf-lua").actions.file_vsplit }
end, opts "LSP Definitions (vertical split)")
map("n", "gr", function()
require("fzf-lua").lsp_references()
end, opts "LSP References")
end
M.rustacean = {
server = {
-- on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
default_settings = {
["rust-analyzer"] = {
check = { command = "clippy" },
checkOnSave = true,
cargo = {
targetDir = true,
-- extraArgs = { "--edition=2024" },
},
diagnostics = {
disabled = { "inactive-code", "macro-error" },
},
},
},
on_attach = function(client, bufnr)
M.on_attach(client, bufnr)
map("n", "ga", function()
vim.cmd.RustLsp "codeAction"
end, { buffer = bufnr })
end,
},
tools = {
float_win_config = {
border = "rounded",
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
relative = "cursor",
borderhighlight = "RenamerBorder",
titlehighlight = "RenamerTitle",
focusable = true,
},
},
}
M.typescript = {
code_lens = "on",
expose_as_code_action = "all",
server = {
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
on_attach = function(client, bufnr)
M.on_attach(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
end,
},
-- handlers = {
-- ["textDocument/publishDiagnostics"] = vim.diagnostic.config { virtual_text = false },
-- },
}
return M