]> git.eshelyaron.com Git - emacs.git/commitdiff
Eglot: fix broken indentation of eglot--sig-info
authorJoão Távora <joaotavora@gmail.com>
Sat, 1 Jul 2023 21:49:24 +0000 (22:49 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sat, 1 Jul 2023 21:49:49 +0000 (22:49 +0100)
* lisp/progmodes/eglot.el (eglot--sig-info): Fix.

lisp/progmodes/eglot.el

index d9a835ae844a9aa62d5f6c4c19889ff0c3aced3f..897cf3bc93e45df48a44a70d17c493eee5729028 100644 (file)
@@ -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 <name>(<params>)
-        ;; 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 <name>(<params>)
+      ;; 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)