WA, USA
tryin' to catch the last train out of Omelas
Comment by ~technomancy on ~technomancy/fennel
Could you expand on this? I'm not sure what formatting tools you would use with
fnlfmt
when it's considered canonical and I want to understand these use-cases better.Maybe the best way to explain it is that fnlfmt's goal is not to be the canonical formatter--the goal is to be the reference implementation of the canonical formatting style. Every text editor that supports Fennel is also a formatting tool that should try to implement the same thing.
Without solving the M:N problem LSP-style, every complication to the formatting rules has its cost spread across N different editors.
Given the code-generating nature of macros, I'm wondering if it's okay for a codebase to opt-in to losing the guarantees that a standard format gives you, in exchange for the ability to utilize macros on their own terms.
I don't want to say this is a point we'll never compromise on, but I don't want to sacrifice the "implementation of the standard formatting algorithm" without exploring the alternatives.
For example, tooling built on top of
fnlfmt
could benefit from access to explicit config over implicit config, e.g. a tool today needs to know aboutfnlfmt
macro heuristicswith-
anddef
, but in the future can read the same ruleset, especially iffnlfmt
provides the function to access the configuration.You're right that the
with-*
anddef*
rules need to be better documented; having them noted in some sub-bullet of the readme isn't great. In fact, a full description of the canonical algorithm that fnlfmt implements should be its own separate document.As an example of an alternative, a configuration that does not require a full Fennel parser would be better. Rather than telling Vimscript and elisp programmers that in order to implement their indentation rules they have to understand the entire
.fnlfmtconfig.fnl
file, what if there was a.fnlmacros
file that contained a newline-separated list of identifiers that should be formatted as if they had a body form?I'm not really sure how much I think this is a good idea, but it's at least an example of an alternate solution with a lower implementation burden across the entire ecosystem.
If it's helpful to know, I use a neovim plugin called
conform
which runsfnlfmt
on save, and these are the workarounds I have enabled currently, as well as some I have tried before and / or thought about:This works fine for single-person repositories, but I highly discourage format-on-save for any codebase that has multiple contributors, due to the issues of authorship erasure. Indenting on a per-line or a per-function basis is the only thing that works on a larger scale.
(Strings vs. keywords is the only other difference I could think of where context matters, but it's not relevant and is easily mitigated with
;;fnlfmt: skip
.)This is one thing I think we can do better on without any negative trade-offs; recent changes to the Fennel parser now make it possible to wrap AST nodes in a way that can preserve formatting details like :kw-style or 0xfab0 notation for numbers. So there's potential for improvement here.
-Phil
Comment by ~technomancy on ~technomancy/fennel
The difficulty is that fnlfmt is meant to implement some "standard" formatting style which other formatting tools (emacs, vim, etc) can also implement. If it loads configuration from a file that is specific to fnlfmt, then it's unreasonable for other formatting tools to be able to consistently agree with fnlfmt, which severely diminishes the utility of fnlfmt.
In theory this problem of having one standard implementation used by all tools could be solved by LSP, but unfortunately LSP does not implement the necessary commands to support this as the spec does not include any commands for reindenting the line you're editing. (LSP does include a command to format an entire file, but this is not sufficient as it erases authorship data for lines that would not otherwise be edited.)
It's a tricky problem. I don't like it, but given the desire to emphasize consistency across all tools so far I've yet to come up with a better solution than the convention of
with-*
anddef*
.
Ticket created by ~technomancy on ~xerool/fennel-ls
These were not removed in 5.3, but they were marked as deprecated: https://www.lua.org/manual/5.3/manual.html#8.2
website added by ~technomancy on ~technomancy/fennel
enhancement added by ~technomancy on ~technomancy/fennel
Ticket created by ~technomancy on ~technomancy/fennel
When you visit https://fennel-lang.org it loads up fengari (twice) and fennel.lua (twice) as soon as the page loads. We should load it when someone focuses the repl element instead.
website added by ~technomancy on ~technomancy/fennel
bug added by ~technomancy on ~technomancy/fennel
Ticket created by ~technomancy on ~technomancy/fennel
The web repl at https://fennel-lang.org/v1.0.0/ should use Fennel 1.0.0, but in fact it uses 1.5.0.
Comment by ~technomancy on ~technomancy/fennel
Thanks. I think d9be3b8 handles this now.
REPORTED
RESOLVED FIXED