Skip to content

Commit

Permalink
Refactor lsp--document-highlight-callback to check window visibility …
Browse files Browse the repository at this point in the history
…before constructing overlay

Signed-off-by: Eval EXEC <[email protected]>
  • Loading branch information
eval-exec committed Jul 28, 2024
1 parent 3afc562 commit f57fd3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Added a new optional ~:action-filter~ argument when defining LSP clients that allows code action requests to be modified before they are sent to the server. This is used by the Haskell language server client to work around an ~lsp-mode~ parsing quirk that incorrectly sends ~null~ values instead of ~false~ in code action requests.
* Add support for C# via the [[https://github.com/dotnet/roslyn/tree/main/src/LanguageServer][Roslyn language server]].
* Add basic support for [[https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics][pull diagnostics]] requests.
* Optimize overlay creation by checking window visibility first

** 9.0.0
* Add language server config for QML (Qt Modeling Language) using qmlls.
Expand Down
18 changes: 9 additions & 9 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -6260,15 +6260,15 @@ A reference is highlighted only if it is visible in a window."
(-map
(-lambda ((start-window . end-window))
;; Make the overlay only if the reference is visible
(let ((start-point (lsp--position-to-point start))
(end-point (lsp--position-to-point end)))
(when (and (> (1+ start-line) start-window)
(< (1+ end-line) end-window)
(not (and lsp-symbol-highlighting-skip-current
(<= start-point (point) end-point))))
(-doto (make-overlay start-point end-point)
(overlay-put 'face (cdr (assq (or kind? 1) lsp--highlight-kind-face)))
(overlay-put 'lsp-highlight t)))))
(when (and (> (1+ start-line) start-window)
(< (1+ end-line) end-window))
(let ((start-point (lsp--position-to-point start))
(end-point (lsp--position-to-point end)))
(when (not (and lsp-symbol-highlighting-skip-current
(<= start-point (point) end-point)))
(-doto (make-overlay start-point end-point)
(overlay-put 'face (cdr (assq (or kind? 1) lsp--highlight-kind-face)))
(overlay-put 'lsp-highlight t))))))
wins-visible-pos))
highlights)))

Expand Down

0 comments on commit f57fd3e

Please sign in to comment.