Skip to content

Commit

Permalink
completzion with arg1
Browse files Browse the repository at this point in the history
  • Loading branch information
mdbergmann committed Nov 6, 2022
1 parent 6ad9ccd commit f2b1153
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/lfe-ls/src/completion-util.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ But for right now there is no better place."
(case func
('null module)
(#"" module)
(fn fn))))
(fn (case arity
('null fn)
(0 fn)
(1 (lfe_io:format1 "~s ~s" `(,fn "${1:arg1}"))))))))
(result `(#(#"label" ,label)
#(#"kind" ,kind)
#(#"detail" ,detail)
Expand Down
26 changes: 26 additions & 0 deletions apps/lfe-ls/test/completion-util-tests.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,29 @@
func "bar"
arity 0
kind (completion-item-kind-function)))))
(deftest generate-json--arity-null
(is-equal '(#(#"label" #"foo:bar")
#(#"kind" 3)
#(#"detail" #"")
#(#"insertTextFormat" 2)
#(#"insertText" #"bar"))
(completion-util:to-json
(make-completion-item
module "foo"
func "bar"
arity 'null
kind (completion-item-kind-function)))))
(deftest generate-json--arity-1
(is-equal '(#(#"label" #"foo:bar/1")
#(#"kind" 3)
#(#"detail" #"")
#(#"insertTextFormat" 2)
#(#"insertText" #"bar ${1:arg1}"))
(completion-util:to-json
(make-completion-item
module "foo"
func "bar"
arity 1
kind (completion-item-kind-function)))))

0 comments on commit f2b1153

Please sign in to comment.