1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-05 11:45:45 +00:00

Eglot: don't paint hints outside requested region (bug#61812)

* lisp/progmodes/eglot.el (eglot--lambda): Add cl-block.
(eglot--update-hints-1): Return early if hint is outside the
requested inlay hint range.
This commit is contained in:
João Távora 2023-02-27 14:23:35 +00:00
parent 11c1aa1eb1
commit 4a5eda7ed2

View File

@ -641,7 +641,7 @@ Honor `eglot-strict-mode'."
Honor `eglot-strict-mode'."
(declare (indent 1) (debug (sexp &rest form)))
(let ((e (cl-gensym "jsonrpc-lambda-elem")))
`(lambda (,e) (eglot--dbind ,cl-lambda-list ,e ,@body))))
`(lambda (,e) (cl-block nil (eglot--dbind ,cl-lambda-list ,e ,@body)))))
(cl-defmacro eglot--dcase (obj &rest clauses)
"Like `pcase', but for the LSP object OBJ.
@ -3595,6 +3595,7 @@ If NOERROR, return predicate, else erroring function."
(paint-hint
(eglot--lambda ((InlayHint) position kind label paddingLeft paddingRight)
(goto-char (eglot--lsp-position-to-point position))
(when (or (> (point) to) (< (point) from)) (cl-return))
(let ((ov (make-overlay (point) (point)))
(left-pad (and paddingLeft (not (memq (char-before) '(32 9)))))
(right-pad (and paddingRight (not (memq (char-after) '(32 9)))))