From: João Távora Date: Wed, 9 Jan 2019 21:09:35 +0000 (+0000) Subject: Handle label offsets in parameterinformation X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~340 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9cedae50a27f0d0d6adee82976654d63c9f67602;p=emacs.git Handle label offsets in parameterinformation At least ccls uses this. * eglot.el (eglot-client-capabilities): Declare support for :labelOffsetSupport. (eglot--sig-info): Handle label offsets in ParameterInformation GitHub-reference: fix https://github.com/joaotavora/eglot/issues/201 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 2ab4bd864a9..befa6cdf454 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -477,7 +477,10 @@ treated as in `eglot-dbind'." :json-false)) :contextSupport t) :hover `(:dynamicRegistration :json-false) - :signatureHelp `(:dynamicRegistration :json-false) + :signatureHelp (list :dynamicRegistration :json-false + :signatureInformation + `(:parameterInformation + (:labelOffsetSupport t))) :references `(:dynamicRegistration :json-false) :definition `(:dynamicRegistration :json-false) :documentSymbol (list @@ -1992,12 +1995,18 @@ is not active." ;; ...perhaps highlight it in the formals list (when params-start (goto-char params-start) - (let ((regex (concat "\\<" (regexp-quote label) "\\>")) - (case-fold-search nil)) - (when (re-search-forward regex params-end t) - (add-face-text-property - (match-beginning 0) (match-end 0) - 'eldoc-highlight-function-argument)))) + (pcase-let + ((`(,beg ,end) + (if (stringp label) + (let ((case-fold-search nil)) + (and (re-search-forward + (concat "\\<" (regexp-quote label) "\\>") + params-end t) + (list (match-beginning 0) (match-end 0)))) + (mapcar #'1+ (append label nil))))) + (add-face-text-property + beg end + 'eldoc-highlight-function-argument))) ;; ...and/or maybe add its doc on a line by its own. (when documentation (goto-char (point-max))