Rework project discovery
Closed this issue · 1 comments
In order to avoid spawning unnecessary nimsuggest
processes we must improve the way the lang server handles files.
For instance, when the user opens a file (i.e. navigates to a type) that is part of the nimble
requires
the langserver should not spawn a new nimsuggest
process but to reuse the existing one. The discovery process should also take into account things like opening a file in an arbitrary package. So instead of using the current file as a program itself, it should try to find the nimble
project where it belongs (this may require changes in nimble
). Changes in files should also be taking into consideration, for instance if the nimble
entry point import
module b
, the module b
nimsuggest
's process must be closed and use the nimble
one instead.
In order to do the above, we must first document via tests what's currently supported.
When opening testproject/submodule.nim
which is not imported by testproject.nim
the langserver gets all wrong. It sets as main project testproject.nim
which effectively left out of IDE support to the submodule.nim
file.
What it should instead is to create a nimsuggest
instance for submodule.nim
if it is not part of the testproject.nim
which isnt because it's not being imported. If it were imported, the behaviour would be correct.