aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2021-11-27 12:32:40 -0700
committerGregory Anders <greg@gpanders.com>2021-11-27 12:32:40 -0700
commitd93f47dc8319a58ff537819978cb965c66b6ea01 (patch)
tree2a26469672622c054a834fafded7a345f754397a /runtime/lua/vim
parent03d250eb4504d5168a754d0f3b7e9992337d60b4 (diff)
downloadrneovim-d93f47dc8319a58ff537819978cb965c66b6ea01.tar.gz
rneovim-d93f47dc8319a58ff537819978cb965c66b6ea01.tar.bz2
rneovim-d93f47dc8319a58ff537819978cb965c66b6ea01.zip
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.
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/diagnostic.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index e1ee6e11a6..095cdf486a 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -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(