From 50eda6a8971587bf1f690fbae645c45d5ae36d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juuso=20Valkeej=C3=A4rvi?= Date: Sun, 7 Oct 2018 01:45:26 +0300 Subject: [PATCH] Fix autocompletion of file names in js2-mode when lsp is used Do transformation only when completions are returned by lsp. --- layers/+tools/lsp/funcs.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/layers/+tools/lsp/funcs.el b/layers/+tools/lsp/funcs.el index b6f69eb2f..013239f5f 100644 --- a/layers/+tools/lsp/funcs.el +++ b/layers/+tools/lsp/funcs.el @@ -43,7 +43,10 @@ https://github.com/emacs-lsp/lsp-javascript/issues/9#issuecomment-379515379" (interactive) (defun lsp-prefix-company-transformer (candidates) (let ((completion-ignore-case t)) - (all-completions (company-grab-symbol) candidates))) + (if (and (car candidates) + (get-text-property 0 'lsp-completion-prefix (car candidates))) + (all-completions (company-grab-symbol) candidates) + candidates))) (make-local-variable 'company-transformers) (add-to-list 'company-transformers 'lsp-prefix-company-transformer))