[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot ff04bc0 06/45: Improve signature help
From: |
João Távora |
Subject: |
[elpa] externals/eglot ff04bc0 06/45: Improve signature help |
Date: |
Thu, 22 Nov 2018 19:15:27 -0500 (EST) |
branch: externals/eglot
commit ff04bc0eb1e5526fe01bdec3158b6f43cff3355e
Author: Michał Krzywkowski <address@hidden>
Commit: Michał Krzywkowski <address@hidden>
Improve signature help
* eglot.el (eglot--sig-info): Don't lose existing information.
Attempt to highlight the active parameter by searching for it's
:label in signature's :label. Append to the result first sentence
of signature's :documentation, if present.
---
eglot.el | 52 +++++++++++++++++++++++++++++++++++-----------------
1 file changed, 35 insertions(+), 17 deletions(-)
diff --git a/eglot.el b/eglot.el
index 7e79b16..57d19b3 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1537,23 +1537,41 @@ is not active."
(defun eglot--sig-info (sigs active-sig active-param)
(cl-loop
for (sig . moresigs) on (append sigs nil) for i from 0
- concat (cl-destructuring-bind (&key label _documentation parameters) sig
- (let (active-doc)
- (concat
- (propertize (replace-regexp-in-string "(.*$" "(" label)
- 'face 'font-lock-function-name-face)
- (cl-loop
- for (param . moreparams) on (append parameters nil) for j from 0
- concat (cl-destructuring-bind (&key label documentation) param
- (when (and (eql j active-param) (eql i active-sig))
- (setq label (propertize
- label
- 'face
'eldoc-highlight-function-argument))
- (when documentation
- (setq active-doc (concat label ": "
documentation))))
- label)
- if moreparams concat ", " else concat ")")
- (when active-doc (concat "\n" active-doc)))))
+ concat (cl-destructuring-bind (&key label documentation parameters) sig
+ (with-temp-buffer
+ (save-excursion (insert label))
+ (when (looking-at "\\([^(]+\\)(")
+ (add-face-text-property (match-beginning 1) (match-end 1)
+ 'font-lock-function-name-face))
+
+ (when (and (stringp documentation) (eql i active-sig)
+ (string-match "[[:space:]]*\\([^.\r\n]+[.]?\\)"
+ documentation))
+ (setq documentation (match-string 1 documentation))
+ (unless (string-prefix-p (string-trim documentation) label)
+ (goto-char (point-max))
+ (insert ": " documentation)))
+ (when (and (eql i active-sig) active-param
+ (< -1 active-param (length parameters)))
+ (cl-destructuring-bind (&key label documentation)
+ (aref parameters active-param)
+ (goto-char (point-min))
+ (let ((case-fold-search nil))
+ (cl-loop for nmatches from 0
+ while (and (not (string-empty-p label))
+ (search-forward label nil t))
+ finally do
+ (when (= 1 nmatches)
+ (add-face-text-property
+ (- (point) (length label)) (point)
+ 'eldoc-highlight-function-argument))))
+ (when documentation
+ (goto-char (point-max))
+ (insert "\n"
+ (propertize
+ label 'face 'eldoc-highlight-function-argument)
+ ": " documentation))))
+ (buffer-string)))
when moresigs concat "\n"))
(defun eglot-help-at-point ()
- [elpa] externals/eglot updated (821b498 -> f291816), João Távora, 2018/11/22
- [elpa] externals/eglot 489080b 02/45: eglot-ignored-server-capabilites: Prefer all choices over "Other", João Távora, 2018/11/22
- [elpa] externals/eglot 69b8428 01/45: Make eglot-ignored-server-capabilites more user-friendly (#126), João Távora, 2018/11/22
- [elpa] externals/eglot 31fcd91 03/45: Handle case when diagnostic :character is out of range, João Távora, 2018/11/22
- [elpa] externals/eglot 9585b74 04/45: Merge pull request #104 from mkcms/fix-diagnostics-wrong-type-argument, João Távora, 2018/11/22
- [elpa] externals/eglot ff04bc0 06/45: Improve signature help,
João Távora <=
- [elpa] externals/eglot f250784 10/45: Handle case when project was not found in eclipse.jdt.ls contact, João Távora, 2018/11/22
- [elpa] externals/eglot c795e3e 09/45: Override eglot-execute-command for eclipse.jdt.ls server, João Távora, 2018/11/22
- [elpa] externals/eglot 5571f10 05/45: Sort references and definitions by line number, João Távora, 2018/11/22
- [elpa] externals/eglot f0b5367 08/45: Per #63: Add support for eclipse.jdt.ls server, João Távora, 2018/11/22
- [elpa] externals/eglot 5b043fb 12/45: * .travis.yml (install): Download eclipse.jdt.ls server., João Távora, 2018/11/22
- [elpa] externals/eglot aefa498 20/45: Larger margin for printing test failure backtraces, João Távora, 2018/11/22
- [elpa] externals/eglot 19aded0 17/45: Remove duplicates from imenu, João Távora, 2018/11/22
- [elpa] externals/eglot 504fd25 14/45: Fix misspelling of "outstanding" (#74), João Távora, 2018/11/22
- [elpa] externals/eglot a406190 07/45: Per #63: Allow function contacts to be interactive, João Távora, 2018/11/22
- [elpa] externals/eglot 27696d6 23/45: Use the container name of a symbol in imenu, João Távora, 2018/11/22