nim-lang / vscode-nim

A VS Code plugin for the Nim language
Other
63 stars 5 forks source link

`nimsuggest` executed on files not declared into `nim.project` or `nim.projectMapping` #45

Closed arkanoid87 closed 3 weeks ago

arkanoid87 commented 4 months ago

TL;DR; These two functions are fighting each other https://github.com/nim-lang/langserver/blob/3eb83dabfba18f079fca72f1b72199f01beb13b5/nimlangserver.nim#L139 https://github.com/nim-lang/vscode-nim/blob/7dfe32a99bd51da7984aaf3d7cd48959751418f5/src/nimProjects.nim#L123


I have foo.nimble with line bin = @["bar"] Both src/foo.nim and src/bar.nim exist .vscode/settings.json is:

{
    "nim.project": [
        "src/bar.nim"
    ]
}

When vscode is launched, nimsuggest is executed only on src/foo.nim and warning is raised for src/bar.nim:

/home/arkanoid/nim/example/src/bar.nim is not compiled as part of project /home/arkanoid/nim/example/src/foo.nim. In orde to get the IDE features working you must either configure nim.projectMapping or import the module.

I can clearly see that the settings.json file is read into the DBG Received the following configuration debug terminal.

basically getProjectFileAutoGuess overwrites user preference in settings.json

jmgomez commented 3 weeks ago

Thanks for reporting it. But this is a nimlangserver issue. Im reworking the way it looks at files. Feel free to report it in there