I have a Rascal/Flybytes project in VSCode. When I define two modules, even if they are in the same folder, they cannot import each other. Consider the files A.rsc
and B.rsc
in the same folder:
module A
int a() = 2;
module B
import A; //line 3
int b() {
return a(); //line 6
}
Then I get 3 errors in module B:
For line 3:
Reference to name
A
cannot be resolved
Undefined module
A
And for line 6:
Undefined
a
When simply opening a shell and importing B
, everything works fine.
The issue also only happens for local modules; importing a Flybytes module, for example, works flawlessly.
What is the problem here? What can I do to make VScode see local modules?
In case it matters, I'm on a Mac with Apple Silicon. I have noticed that the ARM port of VSCode is a bit buggy sometimes.
Seems like the folder was not properly opened in the VScode Explorer. Opening the folder there fixed the problem. I never knew this was necessary, but apparently it is not possible to just open a single Rascal file in VScode without having it spit tons of errors.
VScode is a bit weird in opening files as well - sometimes opening a file/folder just doesn't work and a restart is needed to fix this. But that is a VScode bug and not related to this issue.