Now that nimsuggest is working again, I tried switching source files.
As long as the inspected file is identical with the startup Nim file all works fine.
But for an editor with "Goto Definition" functionality we may open new files, where we want to use "Goto Definition" again.
I have no idea if that is intended to be supported at all, or how other IDE's may do that.
For me personally it would be OK if idetools support is only available for one single file.
But of course then we may wonder why nimsuggest commands do get file names as arguments at all.
I just tried this use case simulated from the command line: Working with strutils.nim request definition of doAssert(), open system.nim and request definition of proc len from within system.nim:
nimsuggest --v2 --stdin /home/stefan/Nim/lib/pure/strutils.nim def /home/stefan/Nim/lib/pure/strutils.nim;/home/stefan/Nim/lib/pure/strutils.nim:2299,6 # request definition of doAssert() def /home/stefan/Nim/lib/system.nim;/home/stefan/Nim/lib/system.nim:1973:14 # request definition of len() lib/system/sysio.nim(168, 17) template/generic instantiation from here lib/system/sysio.nim(168, 17) template/generic instantiation from here lib/system/sysio.nim(168, 17) template/generic instantiation from here lib/system/sysio.nim(168, 17) template/generic instantiation from here
But it seems to be impossible to get useful output for module system.nim
Are we assumed to restart nimsuggest whenever file name changes?
You're not supposed to restart it.
Fine.
And I just found a working file switch:
nimsuggest --v2 --stdin /home/stefan/Nim/lib/pure/parseutils.nim def /home/stefan/Nim/lib/pure/strutils.nim;/home/stefan/Nim/lib/pure/strutils.nim:2014:19 def skProc math.round proc (x: T, places: int): T{.noSideEffect.} /home/stefan/Nim/lib/pure/math.nim 284 5 "" 100
That is exactly what I was hoping for.
Maybe the system module is problematic, because it is divided into multiple subfiles or for other reasons? Unfortunately most stuff is from system.
For the dirtyfile -- for my first tests within my editor some months ago I had the feeling that it works best when I always specify the dirtyfile. I save the textbuffer to /tmp with a unique name and give that name as dirtyfile. That is really fast and generally works fine.