Closed danymat closed 2 years ago
I just checked. It is definitely called, but for some reason print() doesn't work here. Very weird. Maybe on_attach() is called on a background thread and print isn't supported there or something. Not sure if it's a Neovim bug, or maybe this behavior is documented somewhere.
Oh okay, my bad ! Still, vim.diagnostic.hide(nil, buffer)
does not seem to be working, even though it works well when I do it in command mode.
at that point the server probably hasn't yet sent the diagnostics. vim.diagnostic.hide(nil, buffer)
will only hide the diagnostics that are currently displayed.
true, I used vim.diagnostic.disable
instead and it works perfectly ! I can now jump between the ZK links super easily lol
What diagnostics are you getting anyways? I don't get any diagnostics.
You can disable diagnostics like so in your .zk/config.toml
:
[lsp.diagnostics]
# Report titles of wiki-links as hints.
wiki-title = "none"
# Warn for dead links between notes.
dead-link = "none"
I'm using:
[lsp]
[lsp.diagnostics]
# Each diagnostic can have for value: none, hint, info, warning, error
# Report titles of wiki-links as hints.
wiki-title = "hint"
So that I can jump in each wiki title with goto_next
and goto_prev
. I wanted to disable diagnostics so I don't have the virtual text, but still have the jumping enabled, somehow it's working
weird that goto_next
and goto_prev
are still working with diagnostics disabled. something seems off about this.
by the way I'd rather use the following snippet which will only disable the diagnostics that are coming from zk
.
local zk_lsp_client = require("zk.lsp").client()
if zk_lsp_client then
local zk_diagnostic_namespace = vim.lsp.diagnostic.get_namespace(zk_lsp_client.id)
vim.diagnostic.disable(0, zk_diagnostic_namespace)
end
Or better yet, just disable virtual text for zk
diagnostics:
local zk_lsp_client = require("zk.lsp").client()
if zk_lsp_client then
local zk_diagnostic_namespace = vim.lsp.diagnostic.get_namespace(zk_lsp_client.id)
vim.diagnostic.config({virtual_text = false}, zk_diagnostic_namespace)
end
Hello again !
I'm trying to hide diagnostics for
zk
, and I came up with this snippet:However, it seems that the on_attach function is never called, as I never go into the print. Am I missing something here ?