[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 2ede684 06/15: Better decide what text exactly to
From: |
João Távora |
Subject: |
[elpa] externals/eglot 2ede684 06/15: Better decide what text exactly to present as completions |
Date: |
Sun, 20 May 2018 19:59:02 -0400 (EDT) |
branch: externals/eglot
commit 2ede68438087b8e829f1b815308b96c60e000b92
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Better decide what text exactly to present as completions
For inserting, :insertText takes precedence over :label.
For annotating, first sentence of :documentation, then :detail,
then :kind name.
Also remember to send didChange in the :exit-function
* eglot.el (eglot-completion-function): Rework main function and
:annotation-function, and :exit-function
---
eglot.el | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/eglot.el b/eglot.el
index 9d5ef80..e8af7ed 100644
--- a/eglot.el
+++ b/eglot.el
@@ -702,7 +702,7 @@ DEFERRED is passed to `eglot--async-request', which see."
(throw done `(error
,(format "Ooops: %s: %s" code
message))))
:deferred deferred))
- (while t (accept-process-output nil 30)))
+ (while t (accept-process-output nil 30)))
(when (cadr id-and-timer) (cancel-timer (cadr id-and-timer))))))
(when (eq 'error (car res)) (eglot--error (cadr res)))
(cadr res)))
@@ -1300,15 +1300,19 @@ DUMMY is ignored"
:textDocument/completion))
(items (if (vectorp resp) resp (plist-get resp :items))))
(mapcar
- (eglot--lambda (&rest all &key label &allow-other-keys)
- (add-text-properties 0 1 all label) label)
+ (eglot--lambda (&rest all &key label insertText &allow-other-keys)
+ (let ((insert (or insertText label)))
+ (add-text-properties 0 1 all insert) insert))
items))))
:annotation-function
(lambda (obj)
- (propertize (concat " " (or (get-text-property 0 :detail obj)
- (cdr (assoc (get-text-property 0 :kind
obj)
- eglot--kind-names))))
- 'face 'font-lock-function-name-face))
+ (cl-destructuring-bind (&key detail documentation kind
&allow-other-keys)
+ (text-properties-at 0 obj)
+ (concat " " (propertize
+ (or (and documentation
+ (replace-regexp-in-string "\n.*" ""
documentation))
+ detail (cdr (assoc kind eglot--kind-names)))
+ 'face 'font-lock-function-name-face))))
:display-sort-function
(lambda (items)
(sort items (lambda (a b)
@@ -1329,8 +1333,9 @@ DUMMY is ignored"
(font-lock-ensure)
(insert documentation)
(current-buffer)))))
- :exit-function
- (lambda (_string _status) (eglot-eldoc-function))))))
+ :exit-function (lambda (_string _status)
+ (eglot--signal-textDocument/didChange)
+ (eglot-eldoc-function))))))
(defvar eglot--highlights nil "Overlays for textDocument/documentHighlight.")
- [elpa] externals/eglot updated (8e5acb1 -> 24877ae), João Távora, 2018/05/20
- [elpa] externals/eglot c648c4f 08/15: Robustness fixes for the request mechanism, João Távora, 2018/05/20
- [elpa] externals/eglot 3f6d2e2 04/15: Close #4: Collect regions to change as markers, then edit, João Távora, 2018/05/20
- [elpa] externals/eglot a91d72c 01/15: Simplify some infrastructure fucntions, João Távora, 2018/05/20
- [elpa] externals/eglot 258fb98 12/15: Travis now runs python-language-server tests, João Távora, 2018/05/20
- [elpa] externals/eglot 99686a9 11/15: * eglot.el (Version): Bump to 0.4, João Távora, 2018/05/20
- [elpa] externals/eglot 6894ed7 13/15: Tweak tests, hopefully stabilize pyls tests on Travis, João Távora, 2018/05/20
- [elpa] externals/eglot 4b9f4da 03/15: If we're going to send rootPath, better send an absolute one, João Távora, 2018/05/20
- [elpa] externals/eglot 2ede684 06/15: Better decide what text exactly to present as completions,
João Távora <=
- [elpa] externals/eglot 17b7740 05/15: * eglot.el (eglot-clear-status): Remember to update modeline, João Távora, 2018/05/20
- [elpa] externals/eglot b45cb80 02/15: Robustify timer handling for eglot--async-request, João Távora, 2018/05/20
- [elpa] externals/eglot ace6fce 07/15: Check capabilities before sending :completionItem/resolve, João Távora, 2018/05/20
- [elpa] externals/eglot 24877ae 15/15: Fix a bug introduced in the previous commit, João Távora, 2018/05/20
- [elpa] externals/eglot 95c2052 09/15: Handle managed buffers in own process var, João Távora, 2018/05/20
- [elpa] externals/eglot 433361e 10/15: Add some completion tests for pyls, João Távora, 2018/05/20
- [elpa] externals/eglot 50b974f 14/15: Rewrite a couple of defs and shave a yak, João Távora, 2018/05/20