From 9fa0dd072aa3277686ec581ae3075475e02dada6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 20 Aug 2018 01:10:11 +0100 Subject: [PATCH] Consider :triggercharacters in company completion * 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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 3bd342dde6f..4f726440e29 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -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 -- 2.39.2