From 5c0894d57debf038fd535d99f9a8577a42623ed7 Mon Sep 17 00:00:00 2001 From: XeroOl Date: Fri, 29 Aug 2025 15:41:07 -0500 Subject: [PATCH] fix vararg issue in compiler environment --- src/fennel-ls/docs/generated/compiler-env.fnl | 4 ++-- test/lint.fnl | 1 + tools/generate-compiler-env-docs.fnl | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fennel-ls/docs/generated/compiler-env.fnl b/src/fennel-ls/docs/generated/compiler-env.fnl index 04f65fc..6267e4b 100644 --- a/src/fennel-ls/docs/generated/compiler-env.fnl +++ b/src/fennel-ls/docs/generated/compiler-env.fnl @@ -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."}} diff --git a/test/lint.fnl b/test/lint.fnl index 73741a8..7e1b0bb 100644 --- a/test/lint.fnl +++ b/test/lint.fnl @@ -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 [] diff --git a/tools/generate-compiler-env-docs.fnl b/tools/generate-compiler-env-docs.fnl index cbbac30..a271707 100644 --- a/tools/generate-compiler-env-docs.fnl +++ b/tools/generate-compiler-env-docs.fnl @@ -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}