emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/eglot2emacs 6717589c57 086/120: Be more conservative with the ls


From: João Távora
Subject: feature/eglot2emacs 6717589c57 086/120: Be more conservative with the lsp identifier guess
Date: Thu, 20 Oct 2022 07:17:01 -0400 (EDT)

branch: feature/eglot2emacs
commit 6717589c57edb96c7050df7d33cfcdc805a0eaec
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Be more conservative with the lsp identifier guess
    
    If the user is not requesting a prompt, opt for the safer approach
    which is to get the location from textDocument/definition, not from
    workspace/symbol.  Because of things like function overloading, the
    latter is not always successful in finding exactly the definition of
    the thing one is invoking M-. on.
    
    This requires using an xref-internal symbol, which is kind of
    unfortunate.
    
    * eglot.el (xref-backend-identifier-at-point): Rework.
    
    GitHub-reference: per https://github.com/joaotavora/eglot/issues/131
    GitHub-reference: per https://github.com/joaotavora/eglot/issues/314
---
 lisp/progmodes/eglot.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 22eff41f53..0b64cd2301 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2458,10 +2458,11 @@ If BUFFER, switch to it before."
 
 (cl-defmethod xref-backend-identifier-at-point ((_backend (eql eglot)))
   (let ((attempt
-         (puthash :default
-                  (ignore-errors
-                    (eglot--workspace-symbols (symbol-name (symbol-at-point))))
-                  eglot--workspace-symbols-cache)))
+         (and (xref--prompt-p this-command)
+              (puthash :default
+                       (ignore-errors
+                         (eglot--workspace-symbols (symbol-name 
(symbol-at-point))))
+                       eglot--workspace-symbols-cache))))
     (if attempt (car attempt) "LSP identifier at point")))
 
 (defvar eglot--lsp-xref-refs nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]