]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't teardown company if started via trigger chars
authorJoão Távora <joaotavora@gmail.com>
Tue, 5 Feb 2019 21:49:38 +0000 (21:49 +0000)
committerJoão Távora <joaotavora@gmail.com>
Tue, 5 Feb 2019 21:49:38 +0000 (21:49 +0000)
Reported by zhanghj in https://github.com/company-mode/company-mode/issues/866

* eglot.el (eglot-completion-at-point): More carefully calculate
:company-prefix-length

lisp/progmodes/eglot.el

index 2d1c3676f224224cb2af037efb343820b2b530fe..a4b7f8f8e637d141f2ca0738a68812adfd401002 100644 (file)
@@ -1911,9 +1911,12 @@ is not active."
                (insert formatted)
                (current-buffer)))))
        :company-prefix-length
-       (cl-some #'looking-back
-                (mapcar #'regexp-quote
-                        (plist-get completion-capability :triggerCharacters)))
+       (save-excursion
+         (when (car bounds) (goto-char (car bounds)))
+         (looking-back
+          (regexp-opt
+           (cl-coerce (cl-getf completion-capability :triggerCharacters) 'list))
+          (line-beginning-position)))
        :exit-function
        (lambda (comp _status)
          (let ((comp (if (get-text-property 0 'eglot--lsp-completion comp)