Olical / nfnl

Enhance your Neovim with Fennel
The Unlicense
235 stars 8 forks source link

`import-macro` uses nvim cwd and not project cwd. #12

Closed Dotrar closed 1 year ago

Dotrar commented 1 year ago

simple test:

mkdir test
touch test/{macro,.nfnl,file}.fnl

test/macro.fnl

;; [nfnl-macro]
{:test (fn test [])}

test/file.fnl

(import-macros {: test} :macros)
(test)

I would have perhaps expected something like:

  1. attempt to compile the file test/file.fnl
  2. walk up the dir to look for .nfnl.fnl
  3. use that dir (that .nfnl.fnl is in) to act as the dir to resolve macro imports for.

Usecase:

I want to be able to work on my projects, get the feel for a new config, edit the file from my current working directory (ie: inside a work project), and then save and compile my config before going back to what i was working on

this might also affect require calls but i'm not sure.

Olical commented 1 year ago

Require should be okay since it's runtime, import-macros and the include thing that inlines a require are compile time and will need some configuring. Investigating!

Olical commented 1 year ago

This should be fixed, it seems to be for me + in the e2e test suite. Let me know and reopen if not!

Olical commented 1 year ago

Actually, not 100% sure yet, the tests look good but I think it might still be borked.

Olical commented 1 year ago

Okay, what do you think?

Dotrar commented 1 year ago

I think it's fixed! my example usecase works entirely.

thanks so much!