You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you reload a file using :ConjureFnlEvalReload, it takes a relative path to the file and strips the extension. So for example if you reload a file at ./foo/bar.fnl, the reload command will look like this: ,reload foo/bar. This is not the correct incantation:
To require a module that's in a subdirectory, take the file name, replace the slashes with dots, and remove the extension, then pass that to require. For instance, a file called lib/ui/menu.lua would be read when loading the module lib.ui.menu.
— https://fennel-lang.org/tutorial#modules-and-multiple-files
Trying to reload a file like this will not actually reload a proper Fennel require - it will result in two different modules in package.loaded.
You can see for yourself by creating a ./foo/bar.fnl file with the following contents:
;; ./foo/bar.fnl
{:f#:hi}
In the current directory, open a new Fennel file in Neovim, and evaluate these expressions using Conjure:
bar.f gives us the old result despite being reloaded, and in package.loaded we now have two "foo bar" modules.
Two possible fixes:
replace path separators in the module path with dots
don't try to guess the module name and instead ask the user every time which module should be reloaded (that's what the Emacs extension does, I heard).
And thanks a lot for Conjure, I really enjoy using it :)
The text was updated successfully, but these errors were encountered:
When you reload a file using
:ConjureFnlEvalReload
, it takes a relative path to the file and strips the extension. So for example if you reload a file at./foo/bar.fnl
, the reload command will look like this:,reload foo/bar
. This is not the correct incantation:Trying to reload a file like this will not actually reload a proper Fennel require - it will result in two different modules in
package.loaded
.You can see for yourself by creating a
./foo/bar.fnl
file with the following contents:In the current directory, open a new Fennel file in Neovim, and evaluate these expressions using Conjure:
Now, open
./foo/bar.fnl
again and change#:hi
to something else:Run
:ConjureFnlEvalReload
, the log will say:Note the slash in the module name. Re-evaluating the expressions will yield surprising results:
bar.f
gives us the old result despite being reloaded, and inpackage.loaded
we now have two "foo bar" modules.Two possible fixes:
And thanks a lot for Conjure, I really enjoy using it :)
The text was updated successfully, but these errors were encountered: