fix vararg issue in compiler environment

This commit is contained in:
XeroOl 2025-08-29 15:41:07 -05:00
parent ca56679b3d
commit 5c0894d57d
3 changed files with 6 additions and 2 deletions

View File

@ -30,7 +30,7 @@ The ast arg should be unmodified so that its first element is the form called."}
:fnl/arglist ["symbol"]}}
:list {:metadata {:fls/fntype "fn"
:fls/itemKind "Function"
:fnl/arglist [...]
:fnl/arglist ["..."]
:fnl/docstring "Create a new list. Lists are a compile-time construct in Fennel; they are
represented as tables with a special marker metatable. They only come from
the parser, and they represent code which comes from reading a paren form;
@ -52,7 +52,7 @@ Returns nil if passed something other than a multi-sym."}}
:pack {}
:sequence {:metadata {:fls/fntype "fn"
:fls/itemKind "Function"
:fnl/arglist [...]
:fnl/arglist ["..."]
:fnl/docstring "Create a new sequence. Sequences are tables that come from the parser when
it encounters a form with square brackets. They are treated as regular tables
except when certain macros need to look for binding forms, etc specifically."}}

View File

@ -347,6 +347,7 @@
:message "obj.field expects 0 arguments; found 1"}])
(assert-ok (add-opts "(let [foo 10] (fn [] foo))"))
(assert-ok (add-opts "(fn [])"))
(assert-ok (add-opts ";; fennel-ls: macro-file\n(list 1 2 3 4)"))
nil))
(fn test-duplicate-keys []

View File

@ -1,6 +1,7 @@
(local fennel (require :fennel))
(local files (require :fennel-ls.files))
(local compiler (require :fennel-ls.compiler))
(local analyzer (require :fennel-ls.analyzer))
(local navigate (require :fennel-ls.navigate))
(local docs (require :fennel-ls.docs))
@ -21,11 +22,13 @@
(set server.root-uri "file://.")
(local file (files.get-by-uri server uri))
(compiler.compile server file)
(local result (analyzer.search server file (. file.ast (length file.ast)) {} {}))
;; convert results into a doc file
(tset (getmetatable (fennel.sym "x")) :__fennelview #(fennel.view (. $ 1)))
(tset (getmetatable (fennel.varg)) :__fennelview #"\"...\"")
(fn into-doc [result]
(if (= (type result.definition) :string)
{:definition result.definition}