emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/eglot bff921e 60/69: Per #319: always filter completion


From: João Távora
Subject: [elpa] externals/eglot bff921e 60/69: Per #319: always filter completions client-side by prefix
Date: Sun, 20 Oct 2019 08:21:53 -0400 (EDT)

branch: externals/eglot
commit bff921e9dcfd110acd432a7f47de9abf08466917
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Per #319: always filter completions client-side by prefix
    
    Prefix completion is all we get in LSP because there are some servers
    that send *all* completions everytime.  This is horrible, but it's the
    currently defined behaviour.  See
    https://github.com/microsoft/language-server-protocol/issues/651.
    
    * eglot.el (eglot-completion-at-point): Use all-completions.
---
 eglot.el | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/eglot.el b/eglot.el
index f757a8a..ce3705a 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1889,7 +1889,7 @@ is not active."
       (list
        (or (car bounds) (point))
        (or (cdr bounds) (point))
-       (lambda (comp _pred action)
+       (lambda (comp pred action)
          (cond
           ((eq action 'metadata) metadata)                  ; metadata
           ((eq action 'lambda) (member comp completions))   ; test-completion
@@ -1904,20 +1904,23 @@ is not active."
                   (items (if (vectorp resp) resp (plist-get resp :items))))
              (setq
               completions
-              (mapcar
-               (jsonrpc-lambda
-                   (&rest all &key label insertText insertTextFormat
-                          &allow-other-keys)
-                 (let ((completion
-                        (cond ((and (eql insertTextFormat 2)
-                                    (eglot--snippet-expansion-fn))
-                               (string-trim-left label))
-                              (t
-                               (or insertText (string-trim-left label))))))
-                   (put-text-property 0 1 'eglot--lsp-completion
-                                      all completion)
-                   completion))
-               items))))))
+              (all-completions ; <-stuck with prefix-comp because <facepalm> 
LSP
+               comp
+               (mapcar
+                (jsonrpc-lambda
+                    (&rest all &key label insertText insertTextFormat
+                           &allow-other-keys)
+                  (let ((completion
+                         (cond ((and (eql insertTextFormat 2)
+                                     (eglot--snippet-expansion-fn))
+                                (string-trim-left label))
+                               (t
+                                (or insertText (string-trim-left label))))))
+                    (put-text-property 0 1 'eglot--lsp-completion
+                                       all completion)
+                    completion))
+                items)
+               pred))))))
        :annotation-function
        (lambda (obj)
          (eglot--dbind ((CompletionItem) detail kind insertTextFormat)



reply via email to

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