- My project workspace directory can be found at
C:\salix\fantasy
. - The TypeScript configuration file is located at
C:\salix\fantasy\tsconfig.json
Despite my efforts, I'm struggling to have the problem matcher for my project direct to the right location. The TypeScript compiler is displaying error paths relative to the root of the drive, causing issues with vscode treating them as if they are relative to the workspace folder. Consequently, clicking on any problem results in a "file not found" error because of paths like this:
https://i.sstatic.net/3VKSI.png
This is my tsconfig.json file placed in the root of the workspace:
{
"compilerOptions": {
"module": "ESNext",
"target": "ESNext",
"strictNullChecks": true,
"exactOptionalPropertyTypes": true,
"sourceMap": true,
"moduleResolution": "Node",
"removeComments": true,
"outDir": "dist"
},
"include": [
"source/**/*.ts"
],
"exclude": [
"node_modules",
"**/node_modules/*",
"source/shared/libraries/*"
]
}
This is my tasks.json file:
{
"version": "2.0.0",
"tasks": [
{
"label": "Server",
"type": "typescript",
"tsconfig": "tsconfig.json",
"option": "watch",
"problemMatcher": "$tsc-watch",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
- I've attempted various options for the
"cwd"
setting without success. - I've experimented with changing the
"problemMatcher"
using
and"fileLocation": "absolute"
, but neither fixed the issue."fileLocation": "relative"
- I've manually adjusted root and source paths in tsconfig.json, yet TypeScript continues to report errors with paths including
salix/fantasy/
.
salix/fantasy/source/client/dom/h.dynamic.ts:66:44 - error TS2345: Argument of type '{ data: (writer: Writer<any, any>) => Lens<any, any>; changes: Stream<unknown[]>; invalidations: Stream<unknown[]>; sync(origin: TimelineOrigin, dtime: number, dpos: number, client: CursorClient<...>): JobInterface; }' is not assignable to parameter of type 'ConnectionDriver<any>'.
How can I align vscode and the TypeScript compiler on the root path or prohibit the inclusion of salix/fantasy/
in error paths?
EDIT:
After conducting manual compilation through the command line, it's evident that TypeScript correctly reports paths. This indicates an issue where vscode supplies the incorrect root path to the TypeScript compiler. To address this, I modified my task configuration to:
{
"version": "2.0.0",
"tasks": [
{
"label": "Server",
"type": "shell",
"problemMatcher": "$tsc-watch",
"command": "cd ${workspaceFolder}; tsc -w",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
This solution works, though I'm still keen on understanding why the standard "typescript" task type doesn't utilize the correct file location.