Using VS Code with Nim or Nim Alt extension, which internally uses nimsuggest
may lead into issues when you start to write code related to threads.
Simple listing for example ( **aaa.nim** ):
proc main() =
echo $getThreadId()
when isMainModule:
main()
Run
We got issue on line 2 about usage of undeclared identifier getThreadId.
But code is correct, when compiled with \--threads:on switch.
As a solution or workaround, we have to notify nimsuggest, that we use threads
and we can do so by creating nim script file
([https://nim-lang.org/docs/nims.html](https://nim-lang.org/docs/nims.html) ->
NimScript as a configuration file) like so:
**aaa.nims** :
--threads:on
Run
After that, VS Code works as expected.
And question to community: is my solution correct? Or this is some kind of
workaround? Is there any more correct way of doing so?
Tx.