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>
This commit is contained in:
@@ -9,18 +9,11 @@ M.defaults = function()
|
||||
|
||||
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", {
|
||||
cmd = {
|
||||
-- prefer local binary if exists
|
||||
vim.fn.filereadable "./node_modules/.bin/biome" == 1 and "./node_modules/.bin/biome" or "biome",
|
||||
"lsp-proxy",
|
||||
},
|
||||
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "json", "jsonc" },
|
||||
root_dir = vim.fs.root(0, { "biome.json", "biome.jsonc", "biome.config.ts", "package.json", ".git" }),
|
||||
settings = {}, -- add Biome-specific settings if needed
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
on_attach = function(client, _bufnr)
|
||||
-- disable formatting if you want Conform or another tool to handle formatting
|
||||
on_attach = function(client)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end,
|
||||
})
|
||||
@@ -53,6 +46,7 @@ M.defaults = function()
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
virtual_text = false,
|
||||
virtual_lines = { current_line = true },
|
||||
float = {
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
|
||||
Reference in New Issue
Block a user