Fix autocompletion of file names in js2-mode when lsp is used

Do transformation only when completions are returned by lsp.
This commit is contained in:
Juuso Valkeejärvi 2018-10-07 01:45:26 +03:00 committed by Boris Buliga
parent 0f1c461a5c
commit 50eda6a897
No known key found for this signature in database
GPG key ID: 027328150F064FA8

View file

@ -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))