[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 1e1665e 06/22: Rewrite eglot--sig-info a bit for
From: |
João Távora |
Subject: |
[elpa] externals/eglot 1e1665e 06/22: Rewrite eglot--sig-info a bit for readability |
Date: |
Sat, 5 Jan 2019 09:31:02 -0500 (EST) |
branch: externals/eglot
commit 1e1665edfd1f4121545ad934b27905d9ff68a744
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Rewrite eglot--sig-info a bit for readability
* eglot.el (eglot--sig-info): Rewrite a bit.
---
eglot.el | 61 +++++++++++++++++++++++++++++++++----------------------------
1 file changed, 33 insertions(+), 28 deletions(-)
diff --git a/eglot.el b/eglot.el
index 01f6960..429c329 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1941,37 +1941,42 @@ is not active."
(eglot--dbind ((SignatureInformation) label documentation parameters) sig
(with-temp-buffer
(save-excursion (insert label))
- (let ((params-start (point-min))
- (params-end (point-max)))
- (when (looking-at "\\([^(]+\\)(")
- (setq params-start (match-end 0))
+ (let (params-start params-end)
+ ;; Ad-hoc attempt to parse label as <name>(<params>)
+ (when (looking-at "\\([^(]+\\)(\\([^)]+\\))")
+ (setq params-start (match-beginning 2) params-end (match-end 2))
(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 ": " (eglot--format-markup documentation))))
- (when (and (eql i active-sig) active-param
- (< -1 active-param (length parameters)))
- (eglot--dbind ((ParameterInformation) label documentation)
- (aref parameters active-param)
- (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
- (- (point) (length label)) (point)
- 'eldoc-highlight-function-argument)))
- (when documentation
+ (when (eql i active-sig)
+ ;; Decide whether to add one-line-summary to signature line
+ (when (and (stringp documentation)
+ (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 "\n"
- (propertize
- label 'face 'eldoc-highlight-function-argument)
- ": " (eglot--format-markup documentation)))))
+ (insert ": " (eglot--format-markup documentation))))
+ ;; Decide what to do with the active parameter...
+ (when (and (eql i active-sig) active-param
+ (< -1 active-param (length parameters)))
+ (eglot--dbind ((ParameterInformation) label documentation)
+ (aref parameters active-param)
+ ;; ...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))))
+ ;; ...and/or maybe add its doc on a line by its own.
+ (when documentation
+ (goto-char (point-max))
+ (insert "\n"
+ (propertize
+ label 'face 'eldoc-highlight-function-argument)
+ ": " (eglot--format-markup documentation))))))
(buffer-string))))
when moresigs concat "\n"))
- [elpa] externals/eglot 476feb8 07/22: Add edebug specs to destructuring macros, (continued)
- [elpa] externals/eglot 476feb8 07/22: Add edebug specs to destructuring macros, João Távora, 2019/01/05
- [elpa] externals/eglot b8a8901 09/22: Fix #187: be more careful when making xref summaries, João Távora, 2019/01/05
- [elpa] externals/eglot 2f0e51a 13/22: Per #188: use gfm-view-mode, João Távora, 2019/01/05
- [elpa] externals/eglot b393c48 14/22: Fix previous commit where workaround had been removed, João Távora, 2019/01/05
- [elpa] externals/eglot 64da240 19/22: Fix #196: run connection hooks with proper dir-locals, João Távora, 2019/01/05
- [elpa] externals/eglot af9dcad 10/22: Take over Flymake and Eldoc completely while managing buffers, João Távora, 2019/01/05
- [elpa] externals/eglot 5b9a164 01/22: Per #180: frame lsp-mode.el comparison as historical even more evidently, João Távora, 2019/01/05
- [elpa] externals/eglot 7b0d845 17/22: Close #195: remove a hard dependency on flymake-mode, João Távora, 2019/01/05
- [elpa] externals/eglot 923cbbe 08/22: Don't make bogus responses to client/(Un)RegisterCapability, João Távora, 2019/01/05
- [elpa] externals/eglot 85711cc 11/22: * eglot.el (Package-Requires): Require jsonrpc 1.0.7., João Távora, 2019/01/05
- [elpa] externals/eglot 1e1665e 06/22: Rewrite eglot--sig-info a bit for readability,
João Távora <=
- [elpa] externals/eglot e65792f 18/22: Close #197: allow read-only modes for markup rendering, João Távora, 2019/01/05
- [elpa] externals/eglot c5dea9a 20/22: * eglot.el (eglot-workspace-configuration): Safe when listp., João Távora, 2019/01/05
- [elpa] externals/eglot 83f7f84 21/22: Appease checkdoc, João Távora, 2019/01/05
- [elpa] externals/eglot 35597d2 22/22: Handle (un)registerCapability requests via generic functions, João Távora, 2019/01/05