nim-lang / NimLime

The official Nim programming language plugin for Sublime Text
MIT License
132 stars 34 forks source link

Present working directory for `nim check` should probably be your project? #110

Closed joshgoebel closed 5 years ago

joshgoebel commented 6 years ago

I have a project in ~/git/nim/pastie.

I'm editing the files with Sublime 3 (my project root is ~/git/nim/pastie) and when saving them the built in nim check is going bonkers. I know why. I have a macro that's running from this file that walks the directory and pulls in other files to compile them. The path passed to walkDir seems to be relative to the path you are running the compiler from. When NimLime runs nim check it's running it from some other location, the macro fails to import the files, and then check reports errors because of missing code.

I skimmed the source but I didn't see any setting or concept of running check in the context of any given path or not.

Any ideas?

Saving the file in my editor

pastes.nim(27, 17) Error: undeclared identifier: 'pastes_index_view'
(and others cascading)

From the shell

From a console prompt in this folder (works fine):

> nim check app/controllers/pastes.nim
Hint: operation successful (54479 lines compiled; 0.826 sec total; 60.418MiB peakmem; Debug Build) [SuccessX]
joshgoebel commented 6 years ago

I was able to resolve this by modifying my source to usecurrentSourcePath() to eliminate the issue by not caring where it's compiled form.

Varriount commented 5 years ago

I've modified the current development branch to change the working directory to that of the file being checked, however it's better to have your code support a compile running from any directory.