branch: externals/phpinspect
commit 0b210309e7be58ab22c980fe388dc1945d772098
Author: Hugo Thunnissen <de...@hugot.nl>
Commit: Hugo Thunnissen <de...@hugot.nl>

    Fix variable suggestion when there are loose dollar signs in the buffer
---
 phpinspect.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/phpinspect.el b/phpinspect.el
index be0872f55b..1a4482ee33 100644
--- a/phpinspect.el
+++ b/phpinspect.el
@@ -898,11 +898,12 @@ level of a token. Nested variables are ignored."
   (phpinspect--construct-completion
    :value (phpinspect--variable-name completion-candidate)
    :meta (phpinspect--format-type-name
-          (phpinspect--variable-type completion-candidate))
+          (or (phpinspect--variable-type completion-candidate)
+              phpinspect--null-type))
    :annotation (concat " "
                        (phpinspect--type-bare-name
                         (or (phpinspect--variable-type completion-candidate)
-                            (phpinspect--make-type :name "\\"))))
+                            phpinspect--null-type)))
    :kind 'variable))
 
 (cl-defstruct (phpinspect--completion-list
@@ -1035,7 +1036,10 @@ static variables and static methods."
                 ((phpinspect-block-p potential-variable)
                  (dolist (nested-token (cdr potential-variable))
                    (push nested-token token-list))))))))
-    variables))
+
+    ;; Only return variables that have a name. Unnamed variables are just 
dollar
+    ;; signs (:
+    (seq-filter #'phpinspect--variable-name variables)))
 
 (defun phpinspect--suggest-at-point ()
       (phpinspect--log "Entering suggest at point." )

Reply via email to