For those of you coming across this that are using a monorepo setup with a single repository, vscode multi root workspaces and turborepo project structure, the accepted answer was not a sufficient solution.
For me, my initial vscode workspace file looked like this (located at .vscode/default.code-workspace in my repository).
Broken Configuration:
{
"folders": [
{
"path": ".",
"name": "vscode settings",
},
{
"path": "../apps/app1",
"name": "apps/app1",
},
{
"path": "../packages/package1",
"name": "packages/package1",
},
etc...
],
"settings": {
"typescript.tsdk": "root/node_modules/typescript/lib",
},
}
This however resulted in an issue where my files were being read correctly, but when the composer attempted edits, it would always try to create the file relative to the first directory (in this case my .vscode directory). I realized that a fix for this was to add the first entry of the workspace file as the root of the repository (see below). This unfortunately has the consequence of a bit higher memory usage so it’s more of a hack until cursor team handles multi root workspace indexing.
Fixed configuration:
{
"folders": [
{
"path": "..",
"name": "root",
},
{
"path": ".",
"name": "vscode settings",
},
{
"path": "../apps/app1",
"name": "apps/app1",
},
{
"path": "../packages/package1",
"name": "packages/package1",
},
etc...
],
"settings": {
"typescript.tsdk": "root/node_modules/typescript/lib",
},
}