Reputation: 2369
I have a problem with tasks.json, which I have simplified by reducing it to the following.
At the root of my Visual Studio Code project, clearly visible inside of the file explorer sidebar as a root folder is .vscode, and inside of .vscode is tasks.json. This was auto-generated for my by VSCode and I did not move the folder or the project or point VSCode to a different folder.
The contents of tasks.json is as follows:
{
"version": "0.1.0",
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "tsc",
// The command is a shell script
"isShellCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "silent",
// args is the HelloWorld program to compile.
"args": ["test.ts"],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
Please note that the original default value of "args" was ["HelloWorld.ts"], however I have simply changed it to ["test.ts"].
Now, when I press ctrl-shift-b, I get the following:
error TS6053: File 'HelloWorld.ts' not found.
Note that I do clear the output in the output window every time I attempt this. It looks like VSCode is ignoring my tasks.json file and is using default settings.
I am on Ubuntu 14.04.
Upvotes: 4
Views: 3825
Reputation: 179
Another thing to check is to make absolutely sure that the file(s) you are targeting with your task are contained within the root of your VSCode project folder at or below the same level as your .vscode folder that contains the tasks.json file.
I just experienced the same issue with a C project. Restarting VSCode and rebooting the computer had no effect. I eventually realized the copy of the .c file I was attempting to build had been opened from outside the root of the project. Once I opened the correct file inside the project folder everything worked as expected.
Upvotes: 0
Reputation: 1682
Sounds like you had a weird error... if you closed and reopened Visual studio code, it doesn't seem like that was the problem?
I have not heard of that kind of error happening before. If you continue to get it, open an issue on the vscode github repo.
Otherwise, I'd just assume it was one of those random OS issues solved by a reboot.
That's why I called it a sanity check. Often something simple like a reboot can solve a lot of weird memory/ram errors.
Upvotes: 2