nvim: Disable marksman lsp in zk notebook directories

When a `.zk` directory is found in the current root directory of the
marksman project, the lsp is disabled.

This is because zk delivers its own lsp server with correct following of
note ids instead of full file names which marksman expects and fails to
find.
This commit is contained in:
Marty Oehme 2024-06-27 17:22:03 +02:00
parent e6497a2241
commit 894b7ff175
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -35,9 +35,7 @@ local servers = {
},
},
},
marksman = {
filetypes = { "markdown", "quarto" },
},
marksman = {},
basedpyright = {},
ruff = {},
serve_d = {},
@ -157,6 +155,25 @@ lsp.setup({
local lspconfig = require("lspconfig")
lspconfig.nushell.setup({})
lspconfig.marksman.setup({
filetypes = { "markdown", "quarto" },
on_attach = function(client, bufnr)
-- TODO: for some reason this is always true even though it shouldn't be
if client.config.in_zk_notebook then
vim.defer_fn(function()
vim.lsp.buf_detach_client(bufnr, client.id)
end, 1000)
end
end,
on_new_config = function(conf, new_root)
if require("lspconfig.util").root_pattern(".zk")(new_root) then
conf.in_zk_notebook = true
else
conf.in_zk_notebook = false
end
end,
})
local python_path
-- ensure python virtualenv is determined automatically on lsp start
lspconfig.basedpyright.setup({