[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scratch/backend-completion c807121fbd 1/2: Add lisp/backend-completi
Re: scratch/backend-completion c807121fbd 1/2: Add lisp/backend-completion.el
Tue, 29 Nov 2022 18:44:47 -0500
Gnus/5.13 (Gnus v5.13)
> OK great. But where do you plug the current eglot functions into it.
Something like the patch below?
> Maybe. As I've often told you, all this completion code is hard to
> grasp. I do "get" it somewhat, and I've been working with it intensely
> for a long time. But also, I don't really get it :-) For example, I
> have no solid concept of what a category or a style is, so everything
> just reads like "an indirection from this thing to that other thing".
Some sets of identifiers are designed to play well with prefix
completion, while others are a very poor fit.
The "category" is a loose way to describe to users what kind of "sets of
identifiers" this is completing so users can customize the behavior for
> So I named this thing 'eglot-indirection' . 'eglot-code' may be logical
> for someone who knows what a category means, now but sounds something
> that will make absolutely no sense to me 2 weeks from now.
The `category` should be a name that describe the "kind of thing this
inserts/selects by completion".
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index e1041666754..d88c6b78dc7 100644
@@ -2571,7 +2571,7 @@ eglot--workspace-symbols
(let ((probe (gethash pat cache :missing)))
(if (eq probe :missing) (puthash pat (refresh pat) cache)
- (lookup (pat)
+ (lookup (pat _point)
(let ((res (lookup-1 pat))
(def (and (string= pat "") (gethash :default cache))))
(append def res nil)))
@@ -2579,16 +2579,13 @@ eglot--workspace-symbols
0 'eglot--lsp-workspaceSymbol c)
- (lambda (string _pred action)
- (pcase action
- (`metadata `(metadata
+ (lambda (string point) `(,string . ,point))
. ,(lambda (completions)
- (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))))))
+ (cl-sort completions #'> :key #'score))))))))
(defun eglot--recover-workspace-symbol-meta (string)
"Search `eglot--workspace-symbols-cache' for rich entry of STRING."
@@ -2600,7 +2597,7 @@ eglot--recover-workspace-symbol-meta
(setq v (cdr v))))
'(eglot-indirection-joy (styles . (eglot--lsp-backend-style))))
(cl-defmethod xref-backend-identifier-at-point ((_backend (eql eglot)))