nvim: Fix small lsp issues

This commit is contained in:
Marty Oehme 2025-02-07 16:27:50 +01:00
parent c4ecc41ab9
commit d3e325db86
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -112,7 +112,7 @@ local lsp = {
lspconfig.marksman.setup({ lspconfig.marksman.setup({
filetypes = { "markdown", "quarto" }, filetypes = { "markdown", "quarto" },
on_attach = function(client, bufnr) on_attach = function(client, _)
-- TODO: for some reason this stays true even after rootdir switch? -- TODO: for some reason this stays true even after rootdir switch?
if client.config.in_zk_notebook then if client.config.in_zk_notebook then
local default_handler = vim.diagnostic.handlers.virtual_text local default_handler = vim.diagnostic.handlers.virtual_text
@ -132,7 +132,7 @@ local lsp = {
default_handler.hide(...) default_handler.hide(...)
end, end,
} }
local default_handler = vim.diagnostic.handlers.signs default_handler = vim.diagnostic.handlers.signs
vim.diagnostic.handlers.signs = { vim.diagnostic.handlers.signs = {
show = function(namespace, bufnrr, diagnostics, opts) show = function(namespace, bufnrr, diagnostics, opts)
for i, diagnostic in ipairs(diagnostics) do for i, diagnostic in ipairs(diagnostics) do
@ -164,7 +164,7 @@ local lsp = {
-- ensure python virtualenv is determined automatically on lsp start -- ensure python virtualenv is determined automatically on lsp start
-- we primarily use pyright for cmp lsp completion & hover info -- we primarily use pyright for cmp lsp completion & hover info
lspconfig.basedpyright.setup({ lspconfig.basedpyright.setup({
on_attach = function(client, bufnr) on_attach = function(client, _)
require("core.util").set_python_env() require("core.util").set_python_env()
if python_path == nil then if python_path == nil then
python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir)) python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir))
@ -186,7 +186,7 @@ local lsp = {
}, },
}) })
lspconfig.ruff.setup({ lspconfig.ruff.setup({
on_attach = function(client, bufnr) on_attach = function(client, _)
require("core.util").set_python_env() require("core.util").set_python_env()
client.server_capabilities.hoverProvider = false -- we use pyright for hover info client.server_capabilities.hoverProvider = false -- we use pyright for hover info
if python_path == nil then if python_path == nil then
@ -209,7 +209,7 @@ local lsp = {
pattern = "SpellEnable", pattern = "SpellEnable",
callback = function() callback = function()
lspconfig.ltex.setup({ lspconfig.ltex.setup({
on_attach = function(client, bufnr) on_attach = function(_, _)
if require("core.util").is_available("ltex_extra") then if require("core.util").is_available("ltex_extra") then
require("ltex_extra").setup() require("ltex_extra").setup()
end end