emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/phpinspect 4a75cd350c 1/2: Insert closing parenthesis w


From: ELPA Syncer
Subject: [elpa] externals/phpinspect 4a75cd350c 1/2: Insert closing parenthesis when function does not take any arguments
Date: Thu, 17 Aug 2023 06:58:27 -0400 (EDT)

branch: externals/phpinspect
commit 4a75cd350c4070ea4ea1ee8f70dfcb93c2cc2bb3
Author: Hugo Thunnissen <devel@hugot.nl>
Commit: Hugo Thunnissen <devel@hugot.nl>

    Insert closing parenthesis when function does not take any arguments
---
 phpinspect-completion.el | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/phpinspect-completion.el b/phpinspect-completion.el
index 469275021d..5f4e5ae519 100644
--- a/phpinspect-completion.el
+++ b/phpinspect-completion.el
@@ -35,6 +35,9 @@
 (cl-defstruct (phpinspect--completion
                (:constructor phpinspect--construct-completion))
   "Contains a possible completion value with all it's attributes."
+  (target nil
+          :documentation
+          "The object that this completion is aimed at/completing towards")
   (value nil :type string)
   (meta nil :type string)
   (annotation nil :type string)
@@ -244,6 +247,7 @@ Returns list of `phpinspect--completion'."
    :annotation (concat " "
                        (phpinspect--type-bare-name
                         (phpinspect--function-return-type 
completion-candidate)))
+   :target completion-candidate
    :kind 'function))
 
 (cl-defmethod phpinspect--make-completion
@@ -253,6 +257,7 @@ Returns list of `phpinspect--completion'."
    :meta (phpinspect--format-type-name
           (or (phpinspect--variable-type completion-candidate)
               phpinspect--null-type))
+   :target completion-candidate
    :annotation (concat " "
                        (phpinspect--type-bare-name
                         (or (phpinspect--variable-type completion-candidate)
@@ -286,12 +291,15 @@ Returns list of `phpinspect--completion'."
                    (nreverse affixated)))
                :exit-function
                (lambda (comp-name state)
+                 (let ((comp (phpinspect--completion-list-get-metadata
+                              phpinspect--last-completion-list
+                              comp-name)))
                  (when (and (eq 'finished state)
-                            (eq 'function (phpinspect--completion-kind
-                                           
(phpinspect--completion-list-get-metadata
-                                            phpinspect--last-completion-list
-                                            comp-name))))
-                   (insert "(")))
+                            (eq 'function (phpinspect--completion-kind comp)))
+                   (insert "(")
+                   (when (= 0 (length (phpinspect--function-arguments
+                                       (phpinspect--completion-target comp))))
+                     (insert ")")))))
                :company-kind (lambda (comp-name)
                                (phpinspect--completion-kind
                                 (phpinspect--completion-list-get-metadata



reply via email to

[Prev in Thread] Current Thread [Next in Thread]