vscode-nim icon indicating copy to clipboard operation
vscode-nim copied to clipboard

local `nimbledeps` folder is not included when linting imports

Open gtdrakeley opened this issue 3 years ago • 3 comments

If you are using nimble with the --localdeps flag to keep dependencies local to a project they are not included when linting the files.

As a result nimble build will function as expected but you will have import errors in any source file using installed dependencies.

gtdrakeley avatar Apr 22 '22 04:04 gtdrakeley

Investigated a bit further and it would probably be sufficient to:

  • call nimble list --installed to get a list of installed packages
  • for each one execute nimble path <pkg> to get their path
  • for each path, add a --path:<path> option to the call to nim check or any other tools that need to know the location of installed packages

gtdrakeley avatar Apr 24 '22 19:04 gtdrakeley

Could you achieve the same thing with a cfg file? The extension uses nimsuggest, which is essentially the compiler. If anything Nimble should generate a workable cfg.

Nimble and I aren't friends; I tried to deeply incorporate it in the past. You've got an overall approach, if you can make a clean addition I'll accept the PR. Sorry, I can't even begin to imagine spending any more of my time on that thing.

saem avatar Apr 25 '22 09:04 saem

You can add --NimblePath: "./nimbledeps/pkgs" for Nim 1 and --NimblePath: "./nimbledeps/pkgs2" for Nim 2 to nim.cfg. This enables linting for locally installed dependencies.

johanobergman avatar Nov 23 '23 23:11 johanobergman