vim-lsp icon indicating copy to clipboard operation
vim-lsp copied to clipboard

Fix loss of reference highlights on buffer change

Open stephan-t opened this issue 1 year ago • 0 comments

This PR fixes an issue where document highlighting of references will stop working on buffers that have switched to a different buffer within the same window.

Instead of returning after checking if a buffer already has a text property type added, this commit will remove the existing property type and add it back each time a buffer changes.

To reproduce the issue:

  • enable g:lsp_document_highlight_enabled
  • open a file supported by a language server
  • highlight a reference
  • switch to another buffer (e.g., :bn, :e new, :LspDefinition)
  • switch back to previous buffer (e.g., :bp, CTRL+6, CTRL+O)
  • try to highlight a reference

Before fix:

before

After fix:

after

stephan-t avatar Sep 14 '22 00:09 stephan-t