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:
parent
e6497a2241
commit
894b7ff175
1 changed files with 20 additions and 3 deletions
|
@ -35,9 +35,7 @@ local servers = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
marksman = {
|
marksman = {},
|
||||||
filetypes = { "markdown", "quarto" },
|
|
||||||
},
|
|
||||||
basedpyright = {},
|
basedpyright = {},
|
||||||
ruff = {},
|
ruff = {},
|
||||||
serve_d = {},
|
serve_d = {},
|
||||||
|
@ -157,6 +155,25 @@ lsp.setup({
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
lspconfig.nushell.setup({})
|
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
|
local python_path
|
||||||
-- ensure python virtualenv is determined automatically on lsp start
|
-- ensure python virtualenv is determined automatically on lsp start
|
||||||
lspconfig.basedpyright.setup({
|
lspconfig.basedpyright.setup({
|
||||||
|
|
Loading…
Reference in a new issue