Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Dotrar opened this issue Aug 25, 2023 · 5 comments
Closed

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

Dotrar opened this issue Aug 25, 2023 · 5 comments

Comments

@Dotrar
Copy link

Dotrar commented Aug 25, 2023

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)
  • from home dir, i get a compile error. cd ~; nvim test/file.fnl -c ':w'
  • from project dir, i can compile: cd test; nvim file.fnl -c ':w'

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
Copy link
Owner

Olical commented Aug 25, 2023

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 Olical closed this as completed in 6612ca9 Aug 25, 2023
@Olical
Copy link
Owner

Olical commented Aug 25, 2023

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

@Olical
Copy link
Owner

Olical commented Aug 25, 2023

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

@Olical
Copy link
Owner

Olical commented Aug 25, 2023

Okay, what do you think?

@Dotrar
Copy link
Author

Dotrar commented Aug 26, 2023

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

thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants