From 797efe953028e6b2b1f7e7abe111123a1323b539 Mon Sep 17 00:00:00 2001 From: Hugo Thunnissen Date: Fri, 22 Mar 2024 16:27:35 +0100 Subject: [PATCH] Only attempt to return completion kind when it can be found When completions aren't found this is probably the result of a bug, but errors in corfu's hooks are a pain for users so it is better to handle them gracefully --- phpinspect-completion.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/phpinspect-completion.el b/phpinspect-completion.el index ad82e7c..63a63f0 100644 --- a/phpinspect-completion.el +++ b/phpinspect-completion.el @@ -307,9 +307,13 @@ Returns list of `phpinspect--completion'." (phpinspect--completion-target comp)))) (insert ")"))))) :company-kind (lambda (comp-name) - (phpinspect--completion-kind - (phpinspect--completion-list-get-metadata - phpinspect--last-completion-list - comp-name)))))))) + (let ((comp + (phpinspect--completion-list-get-metadata + phpinspect--last-completion-list + comp-name))) + (if comp + (phpinspect--completion-kind comp) + (phpinspect--log "Unable to find matching completion for name %s" comp-name) + nil)))))))) (provide 'phpinspect-completion)