pragmagic / vscode-nim

An extension for VS Code which provides support for the Nim language.
Other
238 stars 37 forks source link

VSCode workspace not being parsed correctly for Nim suggest #106

Closed pr-yemibedu closed 5 years ago

pr-yemibedu commented 5 years ago

Hello, Looking at line NimUtil Line 51 I see that the toLocalFile function is suppose to do a merge of workspace and filepath. This is causing an error that the project root folder name is being counted twice. NimSuggest is failing because of this.

With base folder add being put in a workspace this is what happens:

The exact error message: "console.ts:136 [Extension Host] Nimsuggest returns unknown port number: cannot find file: e:\projects\nim\add\add\src\add.nim"

There should be another check inside that if the final path is not valid to return something else or report an error. Thank you. Good day.

kosz78 commented 5 years ago

@pr-yemibedu I cant reproduce this behavior, could You please provide example project?

pr-yemibedu commented 5 years ago

Hello, I have put together my problem project that shows my issue (C zip) and a new one without the issue (N zip). They have a workspace over a lib and a bin. opening just the lib in VSCode will provide type information after a few seconds.

coffeepots commented 5 years ago

I have this issue too, as soon as I went from just opening a single folder to using a workspace with multiple folders.

This is causing an error that the project root folder name is being counted twice.

Or put another way, it seems that it's taking the first project directory in the workspace and prepending it to all of them.

For example, say I have two project directories (projA and projB) in the same workspace. Correct paths: c:\repos\projA\file.nim c:\repos\projB\file.nim

For the first project I get: cannot find file: c:\repos\projA\projA\file.nim For the second project I get: cannot find file: c:\repos\projA\projB\file.nim

Unfortunately this means nimsuggest doesn't work with workspaces.

kosz78 commented 5 years ago

Fixed in 805d3f1