oakmac / oakmac/standard-clojure-style-js
Stripping leading commas breaks Fennel macros
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 137
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
The formatter works surprisinly well for Fennel (a Clojure-inspired dialect for Lua), I like the output much better than fnlfmt.
The only issue I encountered is difference in macros, Fennel uses comma for unqoute: ,form is like ~form in Clojure meaning leading commas are significant. When formatter strips them it can break a macro.
Example:
(macro when-let-repro [binding & body]
(let [[binding-form expr] binding]
`(let [temp# ,expr]
(when temp#
(let [,binding-form temp#]
,(unpack body))))))
Leading comma gets stripped:
@@ -2,5 +2,5 @@
(let [[binding-form expr] binding]
`(let [temp# ,expr]
(when temp#
- (let [,binding-form temp#]
+ (let [binding-form temp#]
,(unpack body))))))
Unfortunately Fennel does not support metadata, so adding #_:standard-clj/ignore causes compile error.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the formatter on the supplied Fennel macro example and trace where leading commas are removed. Inspect the formatter's handling of Fennel or Lua syntax; done means the comma before binding-form is preserved so the formatted macro remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100