]> git.eshelyaron.com Git - dict.git/commitdiff
Add test for predicate completion with named arguments
authorEshel Yaron <me@eshelyaron.com>
Sun, 27 Nov 2022 19:34:32 +0000 (21:34 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 27 Nov 2022 19:34:32 +0000 (21:34 +0200)
README.org
sweeprolog-tests.el

index 244528fb749af1403143c068d7192c70e2cbca01..a289c99ce6b15645b5d11c4d0ba34f1c113ec626 100644 (file)
@@ -1648,11 +1648,6 @@ there some further improvements that we want to pursue:
   definition, ideally with optional =PlDoc= comments (see [[#sweeprolog-pldoc][Documenting
   predicates]]).
 
-- Improve the information provided for predicate completion candidates :: predicate
-  completion with ~C-M-i~ should annotate each completion candidate with
-  the names and modes of its arguments, when available.  E.g. say
-  ~foo(+Bar, -Baz)~ instead of ~foo/2~.
-
 - Make predicate completion aware of module-qualification :: predicate
   completion should detect when the prefix it's trying to complete
   starts with a module-qualification ~foo:ba<|>~ and restrict completion
index 183068134ca3d83a21e1a94a5be01087bd17d347..873209840ef1fc0ae6e2e712b9fa2fa4ee894a31 100644 (file)
@@ -262,6 +262,38 @@ foo => barbaz(_, _)"
 
                      ))))
 
+(ert-deftest complete-predicate-with-args ()
+  "Tests completing predicate calls."
+  (let ((temp (make-temp-file "sweeprolog-test"
+                              nil
+                              ".pl"
+                              "
+:- module(foobarbaz, []).
+
+%!  foobarbaz(:Bar, ?Baz:integer) is det.
+
+foobarbaz(_, 5) :- spam.
+
+spam :- foobarb
+"
+                              )))
+    (find-file-literally temp)
+    (sweeprolog-mode)
+    (goto-char (point-max))
+    (backward-char)
+    (call-interactively #'completion-at-point)
+    (should (string= (buffer-string)
+                     "
+:- module(foobarbaz, []).
+
+%!  foobarbaz(:Bar, ?Baz:integer) is det.
+
+foobarbaz(_, 5) :- spam.
+
+spam :- foobarbaz(Bar, Baz)
+"
+                     ))))
+
 (ert-deftest complete-predicate ()
   "Tests completing predicate calls."
   (let ((temp (make-temp-file "sweeprolog-test"