From: João Távora Date: Sat, 1 Jul 2023 21:49:24 +0000 (+0100) Subject: Eglot: fix broken indentation of eglot--sig-info X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a371e1def79dcb2a6448f4b673aea0920c9788d3;p=emacs.git Eglot: fix broken indentation of eglot--sig-info * lisp/progmodes/eglot.el (eglot--sig-info): Fix. --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index d9a835ae844..897cf3bc93e 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3196,51 +3196,51 @@ for which LSP on-type-formatting should be requested." ((:documentation sigdoc)) parameters activeParameter) sig (with-temp-buffer - (insert siglabel) - ;; Ad-hoc attempt to parse label as () - ;; Add documentation, indented so we can distinguish multiple signatures - (when-let (doc (and (not briefp) sigdoc (eglot--format-markup sigdoc))) - (goto-char (point-max)) - (insert "\n" (replace-regexp-in-string "^" " " doc))) - ;; Now to the parameters - (cl-loop - with active-param = (or sig-active activeParameter) - for i from 0 for parameter across parameters do - (eglot--dbind ((ParameterInformation) - ((:label parlabel)) - ((:documentation pardoc))) - parameter - (when (zerop i) - (goto-char (elt parlabel 0)) - (search-backward "(" nil t) - (add-face-text-property (point-min) (point) - 'font-lock-function-name-face)) - ;; ...perhaps highlight it in the formals list - (when (= i active-param) - (save-excursion - (goto-char (point-min)) - (pcase-let - ((`(,beg ,end) - (if (stringp parlabel) - (let ((case-fold-search nil)) - (and (search-forward parlabel (line-end-position) t) - (list (match-beginning 0) (match-end 0)))) - (mapcar #'1+ (append parlabel nil))))) - (if (and beg end) - (add-face-text-property - beg end - 'eldoc-highlight-function-argument))))) - ;; ...and/or maybe add its doc on a line by its own. - (let (fpardoc) - (when (and pardoc (not briefp) - (not (string-empty-p - (setq fpardoc (eglot--format-markup pardoc))))) - (insert "\n " - (propertize - (if (stringp parlabel) parlabel - (apply #'substring siglabel (mapcar #'1+ parlabel))) - 'face (and (eq i active-param) 'eldoc-highlight-function-argument)) - ": " fpardoc))))) + (insert siglabel) + ;; Ad-hoc attempt to parse label as () + ;; Add documentation, indented so we can distinguish multiple signatures + (when-let (doc (and (not briefp) sigdoc (eglot--format-markup sigdoc))) + (goto-char (point-max)) + (insert "\n" (replace-regexp-in-string "^" " " doc))) + ;; Now to the parameters + (cl-loop + with active-param = (or sig-active activeParameter) + for i from 0 for parameter across parameters do + (eglot--dbind ((ParameterInformation) + ((:label parlabel)) + ((:documentation pardoc))) + parameter + (when (zerop i) + (goto-char (elt parlabel 0)) + (search-backward "(" nil t) + (add-face-text-property (point-min) (point) + 'font-lock-function-name-face)) + ;; ...perhaps highlight it in the formals list + (when (= i active-param) + (save-excursion + (goto-char (point-min)) + (pcase-let + ((`(,beg ,end) + (if (stringp parlabel) + (let ((case-fold-search nil)) + (and (search-forward parlabel (line-end-position) t) + (list (match-beginning 0) (match-end 0)))) + (mapcar #'1+ (append parlabel nil))))) + (if (and beg end) + (add-face-text-property + beg end + 'eldoc-highlight-function-argument))))) + ;; ...and/or maybe add its doc on a line by its own. + (let (fpardoc) + (when (and pardoc (not briefp) + (not (string-empty-p + (setq fpardoc (eglot--format-markup pardoc))))) + (insert "\n " + (propertize + (if (stringp parlabel) parlabel + (apply #'substring siglabel (mapcar #'1+ parlabel))) + 'face (and (eq i active-param) 'eldoc-highlight-function-argument)) + ": " fpardoc))))) (buffer-string)))) (defun eglot-signature-eldoc-function (cb)