From 23df63915dc25827d9b27d945555d879cd5d46c8 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Mon, 19 Aug 2019 17:37:09 +0900 Subject: [PATCH] Use :async to candidates --- company-phpactor.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/company-phpactor.el b/company-phpactor.el index b1cb66e..f5aabe7 100644 --- a/company-phpactor.el +++ b/company-phpactor.el @@ -64,6 +64,10 @@ Here we create a temporary syntax table in order to add $ to symbols." candidate) suggestions))) +(defun company-phpactor--get-candidates-async (callback) + "Get completion candidates asynchronously." + (funcall callback (company-phpactor--get-candidates))) + (defun company-phpactor--post-completion (arg) "Trigger auto-import of completed item ARG when relevant." (if (get-text-property 0 'class_import arg) @@ -87,7 +91,9 @@ Here we create a temporary syntax table in order to add $ to symbols." (`annotation (company-phpactor--annotation arg)) (`interactive (company-begin-backend 'company-phpactor)) (`prefix (company-phpactor--grab-symbol)) - (`candidates (company-phpactor--get-candidates)))))) + (`candidates + (cons :async (lambda (callback) + (company-phpactor--get-candidates-async callback)))))))) (provide 'company-phpactor) ;;; company-phpactor.el ends here