Ticket created by ~andreyorst on ~xerool/fennel-ls
When declaring methods with
self
as the first argument, I sometimes forget that I need to call them with a:
instead of.
:(local Foo {}) (fn Foo.new [self x] (setmetatable {:x x} self) (Foo.new 42) ;; warning: Foo.new called without self argument, use (Foo:new 42)A warning would be helpful in this scenario.
Comment by ~andreyorst on ~technomancy/fennel
Pushed a v2 patch: https://lists.sr.ht/~technomancy/fennel/patches/58761
Comment by ~andreyorst on ~technomancy/fennel
This particular case is no longer possible:
>> {:sequence ["fooooooooooooooooo" "baaaaaaaaaaaaaaaaar" "baaaaaaaaaaaaaaaaaz" "quuuuuuuuuuuuuuuuux"]} {:sequence ["fooooooooooooooooo" "baaaaaaaaaaaaaaaaar" "baaaaaaaaaaaaaaaaaz" "quuuuuuuuuuuuuuuuux"]}
Previously, it would violate the line-length rule if the key was too long:
{:seeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeequenceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ["fooooooooooooooooo" "baaaaaaaaaaaaaaaaar" "baaaaaaaaaaaaaaaaaz" "quuuuuuuuuuuuuuuuux"]}
Comment by ~andreyorst on ~technomancy/fennel
More examples for the context.
Before this change, associative tables that had only one key, and a really long value would not be split into multiple lines despite the
:line-length
setting in theview
options:>> {:foo "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar"} {:foo "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar"}After this change, a newline is properly included:
>> {:foo "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar"} {:foo "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar"}This slightly changes how nested data structures are printed:
>> {:sequence ["fooooooooooooo" "baaaaaaaaaaaaar" "baaaaaaaaaaaaaz" "quuuuuuuuuuuuux"]} {:sequence ["fooooooooooooo" "baaaaaaaaaaaaar" "baaaaaaaaaaaaaz" "quuuuuuuuuuuuux"]}Here, the sequence itself doesn't pass the threshold, but the overall map does.
Here, however, both the map and the sequence are above the threshold:
>> {:sequence ["fooooooooooooooooo" "baaaaaaaaaaaaaaaaar" "baaaaaaaaaaaaaaaaaz" "quuuuuuuuuuuuuuuuux"]} {:sequence ["fooooooooooooooooo" "baaaaaaaaaaaaaaaaar" "baaaaaaaaaaaaaaaaaz" "quuuuuuuuuuuuuuuuux"]}This means there would be less indentation in the nested data structures that was previously introduced by long keys.
Comment by ~andreyorst on ~technomancy/fennel
The patch is here: https://lists.sr.ht/~technomancy/fennel/patches/58734
Ticket created by ~andreyorst on ~technomancy/fennel
Fennelview breaks into multiple lines if the line is too long by default, howerver it doesn't work for tables with single key:
>> {:a {:b {:c {:d {:e {:f {:g {:h {:i {:j {:k {:l {:m {:n {:o {:p {:q {:r {:s {:t {:u {:v {:w {:x {:y {:z 42}}}}}}}}}}}}}}}}}}}}}}}}}} {:a {:b {:c {:d {:e {:f {:g {:h {:i {:j {:k {:l {:m {:n {:o {:p {:q {:r {:s {:t {:u {:v {:w {:x {:y {:z 42}}}}}}}}}}}}}}}}}}}}}}}}}}Instead it would be more appropriate to insert a newline after the key to respect the line length:
>> {:a {:b {:c {:d {:e {:f {:g {:h {:i {:j {:k {:l {:m {:n {:o {:p {:q {:r {:s {:t {:u {:v {:w {:x {:y {:z 42}}}}}}}}}}}}}}}}}}}}}}}}}} {:a {:b {:c {:d {:e {:f {:g {:h {:i {:j {:k {:l {:m {:n {:o {:p {:q {:r {:s {:t {:u {:v {:w {:x {:y {:z 42}}}}}}}}}}}}}}}}}}}}}}}}}}I have a patch ready for that.
Comment by ~andreyorst on ~technomancy/fennel
Fixed in 0bb9837
REPORTED
RESOLVED CLOSEDComment by ~andreyorst on ~technomancy/fennel
I think the first one makes more sense, though it is easy to misinterpret it as destructuring. The second one kinda implies that the form should be written as
(each k v (pairs tbl))
which is not right
Ticket created by ~andreyorst on ~technomancy/fennel
the ,find REPL command uses sourcemap, which stores a shortened path, resulting in incorrect path information when source is found:
>> (local fennel (require :fennel)) nil >> ,find fennel.list /data/data/com.termux/files/home/.local/bin/fennel:5733 >> (local uuid (require :io.gitlab.andreyorst.uuid)) nil >> ,find uuid.uuid? ...34eaf90b70ddb0d14ea254/src/io/gitlab/andreyorst/uuid.fnl:96
This breaks editor integration, as the editor can't find the
...34eaf90b70ddb0d14ea254/src/io/gitlab/andreyorst/uuid.fnl
path, which should be.deps/git/io.gitlab.andreyorst/uuid.fnl/209ff4f3a70ba8354034eaf90b70ddb0d14ea254/src/io/gitlab/andreyorst/uuid.fnl
Comment by ~andreyorst on ~technomancy/fennel
So the main issue here is:
When we reload a macro module that was loaded previously by loading a non-macro module, it is removed from the macro-loaded table by the else branch of
reload
. When the module name isinit.fnl
and macros are stored in the same directory ininit-macros.fnl
, it makes sense to remove it frommacro-loaded
as well, but I think it should be done prior to reloading the module, so it would reappear after reloading, as reloading a module will reload the macro module too.So the bug is that it doesn't reappear. I've sent a patch that fixes that, and also restores the module in case of an error when reloading the runtime module: https://lists.sr.ht/~technomancy/fennel/patches/57968