diff --git a/nvim/.config/nvim/lua/plugins/config/lsp.lua b/nvim/.config/nvim/lua/plugins/config/lsp.lua index d81fb37..b4e3236 100644 --- a/nvim/.config/nvim/lua/plugins/config/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/config/lsp.lua @@ -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({