diff --git a/src/fennel-ls/compiler.fnl b/src/fennel-ls/compiler.fnl index a624f3c..262c4ef 100644 --- a/src/fennel-ls/compiler.fnl +++ b/src/fennel-ls/compiler.fnl @@ -174,7 +174,10 @@ later by fennel-ls.language to answer requests from the client." (where [(= -fn-)]) (define-function ast scope) (where [(= -require-) _modname]) - (tset require-calls ast true))) + (tset require-calls ast true) + ;; fennel expands multisym calls into the `:` special, so we need to reference the symbol while we still can + (where [sym] (multisym? sym) (: (tostring sym) :find ":")) + (reference sym scope))) (λ recoverable? [msg] (or (= 1 (msg:find "unknown identifier")) diff --git a/test/completion-test.fnl b/test/completion-test.fnl index f19f69f..2653df0 100644 --- a/test/completion-test.fnl +++ b/test/completion-test.fnl @@ -111,10 +111,13 @@ "(let [foo (require :foo)]\n foo.)))" 1 6 [:my-export :constant] - [:_G :local :doto :1]))) ;; no globals, specials, macros, or others + [:_G :local :doto :1])) ;; no globals, specials, macros, or others ;; (it "suggests fields of strings")) - ;; (it "suggests known fn fields of tables when using a method call multisym") + (it "suggests known fn fields of tables when using a method call multisym" + (check-completion "(local x {:field (fn [])})\n(x:fi" 1 5 [:field]))) + + ;; (it "suggests known fn keys when using the `:` special") ;; (it "suggests known keys when using the `.` special") ;; (it "suggests known module names in `require` and `include` and `import-macros` and `require-macros` and friends")