update to fennel version 1.6.0

This commit is contained in:
XeroOl 2025-10-25 15:14:32 -05:00
parent 148d90a0ba
commit f5ae8f1803
13 changed files with 9012 additions and 5072 deletions

View File

@ -21,6 +21,7 @@
* Disabled by default because 0 *can* be a valid table key in some cases. * Disabled by default because 0 *can* be a valid table key in some cases.
### Changes ### Changes
* Updated to fennel 1.6.0
* Updated to dkjson 2.8 * Updated to dkjson 2.8
### Bug Fixes ### Bug Fixes

2774
deps/fennel.lua vendored

File diff suppressed because one or more lines are too long

3029
fennel

File diff suppressed because one or more lines are too long

View File

@ -94,8 +94,7 @@ Run fennel-ls, the Fennel language server and linter.
(case arg (case arg
(where (or ["-h"] ["--help"])) (print help) (where (or ["-h"] ["--help"])) (print help)
(where (or ["-v"] ["--version"])) (print version) (where (or ["-v"] ["--version"])) (print version)
;; (where (or ["-l" & filenames] ["--lint" & filenames])) (lint filenames) ;; compile error in fennel <= 1.5.4 (where (or ["-l" & filenames] ["--lint" & filenames])) (lint-files filenames)
(where [--lint & filenames] (or (= --lint "--lint") (= --lint "-l"))) (lint-files filenames)
(where (or ["--server"] [nil])) (main-loop (io.input) (where (or ["--server"] [nil])) (main-loop (io.input)
(io.output)) (io.output))
["--fix" "-y" & filenames] (fix-files filenames true) ["--fix" "-y" & filenames] (fix-files filenames true)

View File

@ -356,7 +356,7 @@ identifiers are declared / referenced in which places."
extra-global)) extra-global))
plugin plugin
{:name "fennel-ls" {:name "fennel-ls"
:versions ["1.4.1" "1.4.2" "1.5.0" "1.5.1" "1.5.3" "1.5.4"] :versions ["1.4.1" "1.4.2" "1.5.0" "1.5.1" "1.5.3" "1.5.4" "1.6.0"]
: symbol-to-expression : symbol-to-expression
: call : call
: destructure : destructure

View File

@ -1,91 +1,152 @@
{:assert-compile {:metadata {:fls/fntype "fn" {:assert-compile
:fls/itemKind "Function" {:metadata
:fnl/arglist ["condition" {:fls/fntype
"msg" "fn"
"ast" :fls/itemKind
"?fallback-ast"] "Function"
:fnl/docstring "Assert a condition and raise a compile error with line numbers. :fnl/arglist
["condition" "msg" "?ast" "?fallback-ast"]
:fnl/docstring
"Assert a condition and raise a compile error with line numbers.
The ast arg should be unmodified so that its first element is the form called."}} The ast arg should be unmodified so that its first element is the form called."}}
:ast-source {:metadata {:fls/fntype "fn" :ast-source
:fls/itemKind "Function" {:metadata
:fnl/arglist ["ast"] {:fls/fntype
:fnl/docstring "Get a table for the given ast which includes file/line info, if possible."}} "fn"
:comment {:metadata {:fls/fntype "fn" :fls/itemKind
:fls/itemKind "Function" "Function"
:fnl/arglist ["contents" "?source"]}} :fnl/arglist
:comment? {:metadata {:fls/fntype "fn" ["ast"]
:fls/itemKind "Function" :fnl/docstring
:fnl/arglist ["x"]}} "Get a table for the given ast which includes file/line info, if possible."}}
:fennel-module-name {:metadata {:fls/fntype "fn" :comment
:fls/itemKind "Function" {:metadata
:fnl/arglist []}} {:fls/fntype "fn"
:gensym {:metadata {:fls/fntype "fn" :fls/itemKind "Function"
:fls/itemKind "Function" :fnl/arglist ["contents" "?source"]}}
:fnl/arglist ["base"]}} :comment?
:get-scope {:metadata {:fls/fntype "fn" {:metadata {:fls/fntype "fn" :fls/itemKind "Function" :fnl/arglist ["x"]}}
:fls/itemKind "Function" :fennel-module-name
:fnl/arglist []}} {:metadata {:fls/fntype "fn" :fls/itemKind "Function" :fnl/arglist []}}
:in-scope? {:metadata {:fls/fntype "fn" :gensym
:fls/itemKind "Function" {:metadata {:fls/fntype "fn" :fls/itemKind "Function" :fnl/arglist ["base"]}}
:fnl/arglist ["symbol"]}} :get-scope
:list {:metadata {:fls/fntype "fn" {:metadata {:fls/fntype "fn" :fls/itemKind "Function" :fnl/arglist []}}
:fls/itemKind "Function" :in-scope?
:fnl/arglist ["..."] {:metadata {:fls/fntype "fn" :fls/itemKind "Function" :fnl/arglist ["symbol"]}}
:fnl/docstring "Create a new list. Lists are a compile-time construct in Fennel; they are :list
{:metadata
{:fls/fntype
"fn"
:fls/itemKind
"Function"
: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 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; the parser, and they represent code which comes from reading a paren form;
they are specifically not cons cells."}} they are specifically not cons cells."}}
:list? {:metadata {:fls/fntype "fn" :list?
:fls/itemKind "Function" {:metadata
:fnl/arglist ["x"] {:fls/fntype "fn"
:fnl/docstring "Checks if an object is a list. Returns the object if is."}} :fls/itemKind "Function"
:macro-loaded {:fields {}} :fnl/arglist ["x"]
:macroexpand {:metadata {:fls/fntype "fn" :fnl/docstring "Checks if an object is a list. Returns the object if is."}}
:fls/itemKind "Function" :macro-loaded
:fnl/arglist ["form"]}} {:fields {}}
:multi-sym? {:metadata {:fls/fntype "fn" :macroexpand
:fls/itemKind "Function" {:metadata {:fls/fntype "fn" :fls/itemKind "Function" :fnl/arglist ["form"]}}
:fnl/arglist ["str"] :multi-sym?
:fnl/docstring "Returns a table containing the symbol's segments if passed a multi-sym. {:metadata
{:fls/fntype
"fn"
:fls/itemKind
"Function"
:fnl/arglist
["str"]
:fnl/docstring
"Returns a table containing the symbol's segments if passed a multi-sym.
A multi-sym refers to a table field reference like tbl.x or access.channel:deny. A multi-sym refers to a table field reference like tbl.x or access.channel:deny.
Returns nil if passed something other than a multi-sym."}} Returns nil if passed something other than a multi-sym."}}
:pack {} :pack
:sequence {:metadata {:fls/fntype "fn" {}
:fls/itemKind "Function" :sequence
:fnl/arglist ["..."] {:metadata
:fnl/docstring "Create a new sequence. Sequences are tables that come from the parser when {:fls/fntype
"fn"
:fls/itemKind
"Function"
: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 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."}} except when certain macros need to look for binding forms, etc specifically."}}
:sequence? {:metadata {:fls/fntype "fn" :sequence?
:fls/itemKind "Function" {:metadata
:fnl/arglist ["x"] {:fls/fntype "fn"
:fnl/docstring "Checks if an object is a sequence (created with a [] literal)"}} :fls/itemKind "Function"
:sym {:metadata {:fls/fntype "fn" :fnl/arglist ["x"]
:fls/itemKind "Function" :fnl/docstring "Checks if an object is a sequence (created with a [] literal)"}}
:fnl/arglist ["str" "?source"] :sym
:fnl/docstring "Create a new symbol. Symbols are a compile-time construct in Fennel and are {:metadata
{:fls/fntype
"fn"
:fls/itemKind
"Function"
:fnl/arglist
["str" "?source"]
:fnl/docstring
"Create a new symbol. Symbols are a compile-time construct in Fennel and are
not exposed outside the compiler. Second optional argument is a table describing not exposed outside the compiler. Second optional argument is a table describing
where the symbol came from; should be a table with filename, line, bytestart, where the symbol came from; should be a table with filename, line, bytestart,
and byteend fields."}} and byteend fields."}}
:sym? {:metadata {:fls/fntype "fn" :sym?
:fls/itemKind "Function" {:metadata
:fnl/arglist ["x" "?name"] {:fls/fntype
:fnl/docstring "Checks if an object is a symbol. Returns the object if it is. "fn"
:fls/itemKind
"Function"
:fnl/arglist
["x" "?name"]
:fnl/docstring
"Checks if an object is a symbol. Returns the object if it is.
When given a second string argument, will check that the sym's name matches it."}} When given a second string argument, will check that the sym's name matches it."}}
:table? {:metadata {:fls/fntype "fn" :table?
:fls/itemKind "Function" {:metadata
:fnl/arglist ["x"] {:fls/fntype
:fnl/docstring "Checks if an object any kind of table, EXCEPT list/symbol/varg/comment."}} "fn"
:unpack {} :fls/itemKind
:varg? {:metadata {:fls/fntype "fn" "Function"
:fls/itemKind "Function" :fnl/arglist
:fnl/arglist ["x"] ["x"]
:fnl/docstring "Checks if an object is the varg symbol. Returns the object if is."}} :fnl/docstring
:version {:definition "1.5.3"} "Checks if an object any kind of table, EXCEPT list/symbol/varg/comment."}}
:view {:metadata {:fls/fntype "fn" :unpack
:fls/itemKind "Function" {}
:fnl/arglist ["x" "?options"] :varg?
:fnl/docstring "Return a string representation of x. {:metadata
{:fls/fntype
"fn"
:fls/itemKind
"Function"
:fnl/arglist
["x"]
:fnl/docstring
"Checks if an object is the varg symbol. Returns the object if is."}}
:version
{:definition "1.6.0"}
:view
{:metadata
{:fls/fntype
"fn"
:fls/itemKind
"Function"
:fnl/arglist
["x" "?options"]
:fnl/docstring
"Return a string representation of x.
Can take an options table with the following keys: Can take an options table with the following keys:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -659,9 +659,8 @@ You can read more about how to add lints in docs/linting.md"
;; exception: (/ a b) only needs 1 argument ;; exception: (/ a b) only needs 1 argument
min-params (if (= result (docs.get-builtin server :-)) 1 min-params (if (= result (docs.get-builtin server :-)) 1
(= result (docs.get-builtin server :/)) 1 (= result (docs.get-builtin server :/)) 1
;; TODO Fennel 1.5.4+ has `fn`'s arglist fixed (= result (docs.get-builtin server :fn)) (if (table? (. ast 2)) 1 2)
;; exception: fn only needs one argument ;; TODO: collect arglist is still broken upstream
(= result (docs.get-builtin server :fn)) 1
(= result (docs.get-builtin server :collect)) 2 (= result (docs.get-builtin server :collect)) 2
(or (accumulate [last-required-param nil (or (accumulate [last-required-param nil
i arg (ipairs signature) i arg (ipairs signature)

View File

@ -17,7 +17,7 @@
[{: result}] (client:signature-help uri cursor)] [{: result}] (client:signature-help uri cursor)]
(check-signature expected result))) (check-signature expected result)))
(local fn-signature "(fn name? args docstring? ...)") (local fn-signature "(fn ?name args ?docstring ...)")
(local fn-params [{:label [4 9]} (local fn-params [{:label [4 9]}
{:label [10 14]} {:label [10 14]}
{:label [15 25]} {:label [15 25]}
@ -186,9 +186,9 @@
:parameters fn-params})) :parameters fn-params}))
(fn test-binding-form [] (fn test-binding-form []
(local each-signature "(each [key value (iterator)] ...)") (local each-signature "(each [vals... iterator] ...)")
(local each-params [{:label [6 28]} (local each-params [{:label [6 24]}
{:label [29 32]}]) {:label [25 28]}])
(check "(each |)" (check "(each |)"
{:signature each-signature {:signature each-signature

View File

@ -6,7 +6,7 @@
(sh :git :clone :-c :advice.detachedHead=false :--depth=1 url location))) (sh :git :clone :-c :advice.detachedHead=false :--depth=1 url location)))
;; Vendored Dependency Versions ;; Vendored Dependency Versions
(local fennel-version "1.5.3") (local fennel-version "1.6.0")
(local faith-version "0.2.0") (local faith-version "0.2.0")
(local penlight-version "1.14.0") (local penlight-version "1.14.0")
(local dkjson-version "2.8") (local dkjson-version "2.8")