]> git.eshelyaron.com Git - emacs.git/commitdiff
Consider :triggercharacters in company completion
authorJoão Távora <joaotavora@gmail.com>
Mon, 20 Aug 2018 00:10:11 +0000 (01:10 +0100)
committerJoão Távora <joaotavora@gmail.com>
Mon, 20 Aug 2018 00:10:11 +0000 (01:10 +0100)
* eglot.el (eglot-completion-at-point): Take advantage of
:company-prefix-length.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/80

lisp/progmodes/eglot.el

index 3bd342dde6f582d398bd77477d1a45318ef2c3f6..4f726440e29609dee45fb9a378f9736647624036 100644 (file)
@@ -1384,8 +1384,9 @@ is not active."
 (defun eglot-completion-at-point ()
   "EGLOT's `completion-at-point' function."
   (let ((bounds (bounds-of-thing-at-point 'symbol))
-        (server (eglot--current-server-or-lose)))
-    (when (eglot--server-capable :completionProvider)
+        (server (eglot--current-server-or-lose))
+        (completion-capability (eglot--server-capable :completionProvider)))
+    (when completion-capability
       (list
        (or (car bounds) (point))
        (or (cdr bounds) (point))
@@ -1451,6 +1452,10 @@ is not active."
                (erase-buffer)
                (insert (eglot--format-markup documentation))
                (current-buffer)))))
+       :company-prefix-length
+       (cl-some #'looking-back
+                (mapcar #'regexp-quote
+                        (plist-get completion-capability :triggerCharacters)))
        :exit-function (lambda (obj _status)
                         (cl-destructuring-bind (&key insertTextFormat
                                                      insertText