emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.81k stars 893 forks source link

[feature request] Highlight symbol occurrences outside of visible area #2847

Open kipcd opened 3 years ago

kipcd commented 3 years ago

Would be very nice to have M-x lsp-document-highlight also highlight the symbol occurrences outside of visible area of a buffer.

Relates https://github.com/emacs-lsp/lsp-mode/commit/7961c2021bf058d32286b68002b70f9fde53b29a

Related discussion: https://discord.com/channels/789885435026604033/789890622424219658/840329500176154724

Thanks!

HaraldKi commented 9 months ago

This would be nice indeed. On emacs.stackexchange.com @kragen helped me to implement navigation between the currently highlighted instances of a symbol only to note later that the highlighting is limited to the visible area.

The answer on stackoverflow provides a minimal patch to change the behaviour. The relevant original commit is 0543c631510f6502ffc3f96edeefc0ef6623d904 where it says

should probably improve performances with big files

(my emphasis). Though this may not be relevant for realistic cases. As we get semantic symbols, not arbitrary string snippets, having a huge file with matches all over the place would be kind of a useless situation anyway, afaikt.

Nevertheless, adding a configuration option to opt into full buffer highlighting should be not too difficult.

If this is not outright voted against, I might try a pull-request.