Search code examples
visual-studio-codeworkspace

Specifying additional source folders in Visual Studio Code


I'm porting two AS3 projects to TS using Visual Studio Code.

The second project uses code from the first project's folders. I wonder if it is possible to specify additional source folders outside the main source folder in Visual Studio Code, like in the old good FlashBuilder.

For example:

Main source folder: "src"
Additional folders: ["../previous_project/src", "../previous_project/libs"]

This way I can use or extend classes from the external projects like if they were saved in the main source folder.

Investigating a bit I've found that the 'Insiders' version of Visual Studio Code have something called 'multi-root workspaces'. I made some experiment with it, but I must be doing something wrong: When compiling, I get:

"error TS6059: File is not under 'rootDir'.
'rootDir' is expected to contain all source files."

So, how do I specify additional source folders in Visual Studio Code?


Solution

  • After playing a bit more with workspaces, it seems that commeting out "rootDir" in tsconfig.json removes 'error TS6059'. Now I can compile with no issues.

    It would be good to see a correct example of multi-root workspaces, though.