[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/eglot2emacs b59fa2548e 083/120: Cosmetic decisions guaranteed to
From: |
João Távora |
Subject: |
feature/eglot2emacs b59fa2548e 083/120: Cosmetic decisions guaranteed to tick off someone somewhere (tm) |
Date: |
Thu, 20 Oct 2022 07:17:00 -0400 (EDT) |
branch: feature/eglot2emacs
commit b59fa2548e5ec86c3f439fd59ad46abf8840a8ea
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Cosmetic decisions guaranteed to tick off someone somewhere (tm)
The symbols returned by the LSP server must be converted to unique
strings if Emacs is to present them in a list. On the other hand, the
search operates on the pattern and is completely controlled by the
backend. There is not much Eglot, the LSP client, can do about this.
Decided to present the unique string to the user, even though it could
be hidden. All the manner of :annotation-function,
:affixation-function, :group-funcion etc didn't seem to add much
value.
Grouping was especially useless, since it makes sense to respect the
LSP server's account of sorting score, so that better results bubble
up to the top.
* eglot.el (xref-backend-identifier-completion-table): Uniquify
symbols with containerName and kind.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/131
---
lisp/progmodes/eglot.el | 55 ++++++++++++++++++-------------------------------
1 file changed, 20 insertions(+), 35 deletions(-)
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index eccd67c129..6d3667a84a 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2402,11 +2402,20 @@ Try to visit the target file for a richer summary line."
(cl-labels ((refresh (pat)
(mapcar
(lambda (wss)
- (eglot--dbind ((WorkspaceSymbol) name containerName)
wss
+ (eglot--dbind
+ ((WorkspaceSymbol) name containerName kind) wss
(propertize
- (concat (and (not (zerop (length containerName)))
- (format "%s::" containerName))
- name)
+ (format "%s%s %s"
+ (if (zerop (length containerName)) ""
+ (concat (propertize containerName
+ 'face 'shadow)
+ " "))
+ name
+ (propertize (alist-get
+ kind
+ eglot--symbol-kind-names
+ "Unknown")
+ 'face 'shadow))
'eglot--lsp-workspaceSymbol wss)))
(with-current-buffer buf
(jsonrpc-request (eglot--current-server-or-lose)
@@ -2417,41 +2426,17 @@ Try to visit the target file for a richer summary line."
(probe (gethash pat cache :missing)))
(if (eq probe :missing) (puthash pat (refresh pat)
cache)
probe)))
- (container (c)
- (plist-get (get-text-property
- 0 'eglot--lsp-workspaceSymbol c)
- :containerName)))
+ (score (c)
+ (cl-getf (get-text-property
+ 0 'eglot--lsp-workspaceSymbol c)
+ :score 0)))
(lambda (string _pred action)
(pcase action
(`metadata `(metadata
(cycle-sort-function
. ,(lambda (completions)
- (cl-sort completions
- #'string-lessp
- :key (lambda (c)
- (or (container c)
- "")))))
- (category . eglot-indirection-joy)
- ;; (annotation-function
- ;; . ,(lambda (c)
- ;; (plist-get (get-text-property
- ;; 0 'eglot--lsp-workspaceSymbol
c)
- ;; :containerName)))
- ;; (affixation-function
- ;; . ,(lambda (comps)
- ;; (mapcar (lambda (c)
- ;; (list c
- ;; (plist-get
(get-text-property
- ;; 0
'eglot--lsp-workspaceSymbol c)
- ;; :containerName)
- ;; " bla"))
- ;; comps)))
- (group-function
- . ,(lambda (c transformp)
- (if (not transformp)
- (container c)
- c)))
- ))
+ (cl-sort completions #'> :key #'score)))
+ (category . eglot-indirection-joy)))
(`(eglot--lsp-tryc . ,point) `(eglot--lsp-tryc . (,string .
,point)))
(`(eglot--lsp-allc . ,_point) `(eglot--lsp-allc . ,(lookup
string)))
(_ nil)))))
@@ -2475,7 +2460,7 @@ Try to visit the target file for a richer summary line."
;; passed to LSP. The reason for this particular wording is to
;; construct a readable message "No references for LSP identifier at
;; point.". See https://github.com/joaotavora/eglot/issues/314
- "LSP identifier at point.")
+ "LSP identifier at point")
(defvar eglot--lsp-xref-refs nil
"`xref' objects for overriding `xref-backend-references''s.")
- feature/eglot2emacs bbdfbf0456 006/120: Add pyright language server support for python-mode, (continued)
- feature/eglot2emacs bbdfbf0456 006/120: Add pyright language server support for python-mode, João Távora, 2022/10/20
- feature/eglot2emacs a35f6a7f9a 010/120: Support language server for html, css, json and docker, João Távora, 2022/10/20
- feature/eglot2emacs b527764963 023/120: Support racket-langserver, João Távora, 2022/10/20
- feature/eglot2emacs eacc40e3bf 015/120: ; update copyright years, João Távora, 2022/10/20
- feature/eglot2emacs 1616da4f26 030/120: * eglot.el (eglot-strict-mode): very minor docfix., João Távora, 2022/10/20
- feature/eglot2emacs 6a6f4c3d27 041/120: Don't use :exclusive no, João Távora, 2022/10/20
- feature/eglot2emacs 26bd153b90 028/120: Print server command to events buffer, João Távora, 2022/10/20
- feature/eglot2emacs abfb193201 032/120: Remove unnecessary compatibility code, João Távora, 2022/10/20
- feature/eglot2emacs 85ecf46a18 046/120: Have a couple of lsp faces inherit from basic "shadow", João Távora, 2022/10/20
- feature/eglot2emacs 6d815aaa98 057/120: Tweak on-type-formatting code, João Távora, 2022/10/20
- feature/eglot2emacs b59fa2548e 083/120: Cosmetic decisions guaranteed to tick off someone somewhere (tm),
João Távora <=
- feature/eglot2emacs 6717589c57 086/120: Be more conservative with the lsp identifier guess, João Távora, 2022/10/20
- feature/eglot2emacs 3967d22b9c 005/120: ; fix typos, João Távora, 2022/10/20
- feature/eglot2emacs 5c6eb3caa9 074/120: Don't ignore flymake-no-changes-timeout, João Távora, 2022/10/20
- feature/eglot2emacs 6ee995fe6b 094/120: Add marksman server for markdown, João Távora, 2022/10/20
- feature/eglot2emacs 0e8a8697ba 092/120: Merge commit '7738854e09' to fix fallout of force-push in gnu elpa, João Távora, 2022/10/20
- feature/eglot2emacs 51ae66b50c 099/120: Add eglot-show-configuration to debug workspace configurations, João Távora, 2022/10/20
- feature/eglot2emacs 14586fedcf 103/120: Don't exceed max-specdl-size in big go projects, João Távora, 2022/10/20
- feature/eglot2emacs a8b3b6a526 014/120: Add vim-language-server for vimrc-mode, João Távora, 2022/10/20
- feature/eglot2emacs b1c7aa1d17 003/120: Add yaml-language-server for yaml-mode, João Távora, 2022/10/20
- feature/eglot2emacs 51fc8fc3d2 002/120: Use `locate-user-emacs-file` instead of `concat`, João Távora, 2022/10/20