[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot ef80455 121/139: Support :completionItem/resolve
From: |
João Távora |
Subject: |
[elpa] externals/eglot ef80455 121/139: Support :completionItem/resolve |
Date: |
Mon, 14 May 2018 09:55:05 -0400 (EDT) |
branch: externals/eglot
commit ef80455416426fea7bd4e80797365c5ed18bd66f
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Support :completionItem/resolve
This is quite handy with company and company-quickhelp
* eglot.el (eglot-completion-at-point): Send
:completionItem/resolve
* README.md: Mention completionItem/resolve
---
README.md | 3 ++-
eglot.el | 38 +++++++++++++++++++++++++-------------
2 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index c2931be..8a94466 100644
--- a/README.md
+++ b/README.md
@@ -74,7 +74,7 @@ server. To skip the guess and always be prompted use `C-u M-x
eglot`.
## Language features
- [x] textDocument/completion
-- [ ] completionItem/resolve
+- [x] completionItem/resolve (works quite well with
[company-mode][company-mode])
- [x] textDocument/hover
- [ ] textDocument/signatureHelp
- [x] textDocument/definition
@@ -144,5 +144,6 @@ Under the hood:
[emacs-lsp]: https://github.com/emacs-lsp/lsp-mode
[emacs-lsp-plugins]: https://github.com/emacs-lsp
[bash-language-server]: https://github.com/mads-hartmann/bash-language-server
+[company-mode]: https://github.com/company-mode/company-mode
diff --git a/eglot.el b/eglot.el
index 58a2374..3557303 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1278,23 +1278,35 @@ DUMMY is ignored"
:textDocument/completion))
(items (if (vectorp resp) resp (plist-get resp :items))))
(eglot--mapply
- (eglot--lambda (&key insertText label kind detail
- documentation sortText &allow-other-keys)
- (propertize (or insertText label)
- :kind-name (cdr (assoc kind eglot--kind-names))
- :detail detail
- :documentation documentation :sortText sortText))
+ (eglot--lambda (&rest all &key label &allow-other-keys)
+ (add-text-properties 0 1 all label) label)
items))))
:annotation-function
- (lambda (what)
- (propertize (concat " " (or (get-text-property 0 :detail what)
- (get-text-property 0 :kind what)))
+ (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))
:display-sort-function
- (lambda (items) (sort items (lambda (a b)
- (string-lessp
- (get-text-property 0 :sortText a)
- (get-text-property 0 :sortText b)))))
+ (lambda (items)
+ (sort items (lambda (a b)
+ (string-lessp
+ (or (get-text-property 0 :sortText a) "")
+ (or (get-text-property 0 :sortText b) "")))))
+ :company-doc-buffer
+ (lambda (obj)
+ (let ((documentation
+ (or (get-text-property 0 :documentation obj)
+ (plist-get (eglot--request proc :completionItem/resolve
+ (text-properties-at 0 obj))
+ :documentation))))
+ (when documentation
+ (with-current-buffer (get-buffer-create " *eglot doc*")
+ (erase-buffer)
+ (ignore-errors (funcall (intern "markdown-mode")))
+ (font-lock-ensure)
+ (insert documentation)
+ (current-buffer)))))
:exit-function
(lambda (_string _status) (eglot-eldoc-function))))))
- [elpa] externals/eglot 39e8b9e 081/139: Add (dummy) tests and Travis CI integration, (continued)
- [elpa] externals/eglot 39e8b9e 081/139: Add (dummy) tests and Travis CI integration, João Távora, 2018/05/14
- [elpa] externals/eglot 23b79e0 111/139: Shorten summary line to appease package-lint.el, João Távora, 2018/05/14
- [elpa] externals/eglot 37b7329 098/139: Reasonable textDocument/documentHighlight support, João Távora, 2018/05/14
- [elpa] externals/eglot d1cdcf1 119/139: Friendlier M-x eglot, João Távora, 2018/05/14
- [elpa] externals/eglot 764347d 128/139: New command eglot-help-at-point and a README update, João Távora, 2018/05/14
- [elpa] externals/eglot 9bf3166 136/139: Don't define a menu if nothing to show there for now, João Távora, 2018/05/14
- [elpa] externals/eglot 54fc885 113/139: More RLS-specifics: update Flymake diags when indexing done, João Távora, 2018/05/14
- [elpa] externals/eglot 56c2e1d 104/139: Get rid of eglot-mode, João Távora, 2018/05/14
- [elpa] externals/eglot 9577dfc 125/139: Duh, json.el is in Emacs, and json-mode.el is useless here, João Távora, 2018/05/14
- [elpa] externals/eglot d33a9b5 103/139: Simplify eglot--signal-textDocument/didChange, João Távora, 2018/05/14
- [elpa] externals/eglot ef80455 121/139: Support :completionItem/resolve,
João Távora <=
- [elpa] externals/eglot f89f859 114/139: Simplify mode-line updating logic, João Távora, 2018/05/14
- [elpa] externals/eglot 3a6c637 099/139: Support textDocument/rename, João Távora, 2018/05/14
- [elpa] externals/eglot 581608f 115/139: Resist server failure during synchronous requests, João Távora, 2018/05/14
- [elpa] externals/eglot 56cf02d 126/139: Rework autoreconnection logic, João Távora, 2018/05/14
- [elpa] externals/eglot 4c0bfc3 139/139: Support didChangeWatchedFiles with dynamic registration, João Távora, 2018/05/14
- [elpa] externals/eglot 42177d0 107/139: New "deferred requests" that wait until server is ready, João Távora, 2018/05/14
- [elpa] externals/eglot 29f6b4c 129/139: Tweak README.md, João Távora, 2018/05/14
- [elpa] externals/eglot 1fb2bcb 132/139: Ask server for textDocument/signatureHelp if it supports it, João Távora, 2018/05/14
- [elpa] externals/eglot e63dad0 092/139: Simplify mode-line code with a helper., João Távora, 2018/05/14
- [elpa] externals/eglot ab575d2 120/139: Rename functions. eglot--request is now the synchronous one, João Távora, 2018/05/14