-
Hello,
To address this, I implemented a "force-reloading" mechanism in the on_attach function as shown below, and it seems to resolve the issue for me: metals_config.on_attach = function(client, bufnr)
local doc = vim.lsp.util.make_text_document_params()
doc.version = 0
local params = {
textDocument = doc,
contentChanges = {
{
text = table.concat(vim.api.nvim_buf_get_lines(bufnr, 0, -1, true), "\n")
}
},
}
local handler = function(ress)
end
vim.lsp.buf_request_all(0, 'textDocument/didChange', params, handler)
end While this workaround resolves the issue for me, I wonder:
Any insights or advice would be greatly appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @todesking thanks for reporting this. Something is definitely wrong here and the behavior wasn't always this way. I'm not sure if this is something that changed on the Metals side or on the Nvim side. What is happening is when you do a |
Beta Was this translation helpful? Give feedback.
Hey @todesking thanks for reporting this. Something is definitely wrong here and the behavior wasn't always this way. I'm not sure if this is something that changed on the Metals side or on the Nvim side. What is happening is when you do a
:e
atextDocument/didClose
is sent to Metals and then atextDocument/didOpen
is sent to Metals. There are then no diagnostics published. However, that sort of makes sense since the diagnostics were already published and it seems that nvim just loses them, which I wouldn't expect. I need to dig a bit to see if Metals should actually republish them here ( I don't think so ) or better understand why when you close the document Nvim seems to throw away the …