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 (#4511)
  • Loading branch information
eval-exec authored Sep 23, 2024
1 parent 4abe804 commit f02aac0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* Fix bug in ~rust-analyzer.check.features~ configuration via ~lsp-rust-checkonsave-features~ Emacs setting: we were defaulting to ~[]~, but ~rust-analyzer~ defaults to inheriting the value from ~rust-analyzer.cargo.features~. The bug resulted in code hidden behind features not getting type checked when those features were enabled by setting ~rust-analyzer.cargo.features~ via the ~lsp-rust-features~ Emacs setting.
* Change ~ruff-lsp~ to ~ruff~ for python lsp client. All ~ruff-lsp~ customizable variable change to ~ruff~. Lsp server command now is ~["ruff" "server"]~ instead of ~["ruff-lsp"]~.
* Add futhark support
* 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 @@ -6262,15 +6262,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 f02aac0

Please sign in to comment.