fix(conflict): clear stale diagnostics before re-enabling
Problem: after resolving all conflicts, vim.diagnostic.enable(true) restored diagnostics that were cached while markers were present, showing errors like "unexpected token end" on clean code. Solution: call vim.diagnostic.reset() before re-enabling to flush stale results and let the LSP re-analyze the resolved buffer.
This commit is contained in:
parent
35cb13419c
commit
a192830d8c
2 changed files with 5 additions and 1 deletions
|
|
@ -18,6 +18,7 @@ syntax highlighting.
|
||||||
- Vim syntax fallback for languages without a treesitter parser
|
- Vim syntax fallback for languages without a treesitter parser
|
||||||
- Hunk header context highlighting (`@@ ... @@ function foo()`)
|
- Hunk header context highlighting (`@@ ... @@ function foo()`)
|
||||||
- Character-level (intra-line) diff highlighting for changed characters
|
- Character-level (intra-line) diff highlighting for changed characters
|
||||||
|
- Inline merge conflict detection, highlighting, and resolution keymaps
|
||||||
- Configurable debouncing, max lines, diff prefix concealment, blend alpha, and
|
- Configurable debouncing, max lines, diff prefix concealment, blend alpha, and
|
||||||
highlight overrides
|
highlight overrides
|
||||||
|
|
||||||
|
|
@ -63,7 +64,8 @@ luarocks install diffs.nvim
|
||||||
compatible, but both plugins modifying line highlights may produce
|
compatible, but both plugins modifying line highlights may produce
|
||||||
unexpected results
|
unexpected results
|
||||||
- [`git-conflict.nvim`](https://github.com/akinsho/git-conflict.nvim) -
|
- [`git-conflict.nvim`](https://github.com/akinsho/git-conflict.nvim) -
|
||||||
conflict marker highlighting may overlap with `diffs.nvim`
|
`diffs.nvim` now includes built-in conflict resolution; disable one or the
|
||||||
|
other to avoid overlap
|
||||||
|
|
||||||
# Acknowledgements
|
# Acknowledgements
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,7 @@ local function refresh(bufnr, config)
|
||||||
if #regions == 0 then
|
if #regions == 0 then
|
||||||
vim.api.nvim_buf_clear_namespace(bufnr, ns, 0, -1)
|
vim.api.nvim_buf_clear_namespace(bufnr, ns, 0, -1)
|
||||||
if diagnostics_suppressed[bufnr] then
|
if diagnostics_suppressed[bufnr] then
|
||||||
|
pcall(vim.diagnostic.reset, nil, bufnr)
|
||||||
pcall(vim.diagnostic.enable, true, { bufnr = bufnr })
|
pcall(vim.diagnostic.enable, true, { bufnr = bufnr })
|
||||||
diagnostics_suppressed[bufnr] = nil
|
diagnostics_suppressed[bufnr] = nil
|
||||||
end
|
end
|
||||||
|
|
@ -385,6 +386,7 @@ function M.detach(bufnr)
|
||||||
attached_buffers[bufnr] = nil
|
attached_buffers[bufnr] = nil
|
||||||
|
|
||||||
if diagnostics_suppressed[bufnr] then
|
if diagnostics_suppressed[bufnr] then
|
||||||
|
pcall(vim.diagnostic.reset, nil, bufnr)
|
||||||
pcall(vim.diagnostic.enable, true, { bufnr = bufnr })
|
pcall(vim.diagnostic.enable, true, { bufnr = bufnr })
|
||||||
diagnostics_suppressed[bufnr] = nil
|
diagnostics_suppressed[bufnr] = nil
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue