mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
fix(diagnostic): make set() go through cache when calling show()
When `vim.diagnostic.set()` is called, the diagnostics passed to it are added to the diagnostic cache. `set()` then calls `show()` and passes those diagnostics along exactly as they were given to `set()`. However, we sometimes want to do some kind of post-processing on diagnostics when they come out of the cache, e.g. clamping line numbers. By forwarding the diagnostics to `show()` verbatim, `set()` skips this post-processing which can cause other bugs downstream. Instead of passing the diagnostics directly, make the `show()` call from within `set()` retrieve diagnostics from the cache. In general, all diagnostics operations should follow the pattern of "producers put things in the cache" and "consumers get things out of the cache" and this change better adheres to that pattern.
This commit is contained in:
parent
03d250eb45
commit
d93f47dc83
@ -650,7 +650,7 @@ function M.set(namespace, bufnr, diagnostics, opts)
|
||||
end
|
||||
|
||||
if vim.api.nvim_buf_is_loaded(bufnr) then
|
||||
M.show(namespace, bufnr, diagnostics, opts)
|
||||
M.show(namespace, bufnr, nil, opts)
|
||||
end
|
||||
|
||||
vim.api.nvim_command(
|
||||
|
Loading…
Reference in New Issue
Block a user