nvim: Replace null-ls with nvim-lint
Fully replaced null-ls. Will need more tweaking on the nvim-lint setup but works generally for now. Works well in tandem with conform formatter.
This commit is contained in:
parent
5ccf8bc1fc
commit
ab06ef922b
3 changed files with 55 additions and 62 deletions
|
|
@ -59,7 +59,7 @@ local function on_attach(client, bufnr)
|
|||
{ buffer = bufnr, desc = "Next error" }
|
||||
)
|
||||
|
||||
require("which-key").register({ ["<localleader>l"] = { name = "+lsp" } })
|
||||
require("which-key").register({ ["<localleader>l"] = { name = "+language" } })
|
||||
map(
|
||||
"n",
|
||||
"<localleader>ld",
|
||||
|
|
@ -136,23 +136,22 @@ lspconfig.nushell.setup({})
|
|||
local python_path
|
||||
-- ensure python virtualenv is determined automatically on lsp start
|
||||
lspconfig.pyright.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
if python_path == nil then
|
||||
python_path, _ = require("util").get_python_venv(client.config.root_dir)
|
||||
end
|
||||
-- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path)))
|
||||
client.config.settings.python.pythonPath = python_path
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
on_attach = function(client, bufnr)
|
||||
if python_path == nil then
|
||||
python_path, _ = require("util").get_python_venv(client.config.root_dir)
|
||||
end
|
||||
-- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path)))
|
||||
client.config.settings.python.pythonPath = python_path
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
})
|
||||
lspconfig.ruff_lsp.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
if python_path == nil then
|
||||
python_path, _ = require("util").get_python_venv(client.config.root_dir)
|
||||
end
|
||||
-- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path)))
|
||||
client.config.settings.python.pythonPath = python_path
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
@ -163,44 +162,3 @@ if require("util").is_available("arduino") then
|
|||
})
|
||||
end
|
||||
|
||||
local null_ls = require("null-ls")
|
||||
null_ls.setup({})
|
||||
require("mason-null-ls").setup({
|
||||
ensure_installed = { "black", "prettier", "shfmt", "eslint-lsp", "stylua", "jq", "vale", "markdownlint" },
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
shfmt = function(_, _)
|
||||
null_ls.register(null_ls.builtins.formatting.shfmt.with({
|
||||
extra_filetypes = { "bash", "zsh" },
|
||||
}))
|
||||
end,
|
||||
prettier = function(_, _)
|
||||
null_ls.register(null_ls.builtins.formatting.prettier.with({
|
||||
extra_filetypes = { "astro" },
|
||||
disabled_filetypes = { "markdown" },
|
||||
timeout = 7000,
|
||||
}))
|
||||
end,
|
||||
eslint = function(_, _)
|
||||
null_ls.register(null_ls.builtins.diagnostics.eslint.with({
|
||||
extra_filetypes = { "astro" },
|
||||
}))
|
||||
null_ls.register(null_ls.builtins.code_actions.eslint.with({
|
||||
extra_filetypes = { "astro" },
|
||||
}))
|
||||
end,
|
||||
markdownlint = function(_, _)
|
||||
null_ls.register(null_ls.builtins.diagnostics.markdownlint.with({
|
||||
extra_filetypes = { "quarto" },
|
||||
}))
|
||||
end,
|
||||
vale = function(_, _)
|
||||
null_ls.register(null_ls.builtins.diagnostics.vale.with({
|
||||
condition = function(utils)
|
||||
return (utils.root_has_file({ ".vale.ini", "_vale.ini" }) and utils.root_has_file({ "styles/" }))
|
||||
end,
|
||||
}))
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue