I just start to use vscode
in linux. I know that the build configuration are set in tasks.json
. But where does this file locate?
I tried <
2019 Version
New tasks version 2.0.0
Here's how to do it step by step
I compiled this from the documentation:
First i tried ⬆︎ ⌘ B
... This didn't work for me (I was following a YouTube tutorial... a bit outdated it seems).
After looking at the documetation i found that you have to initialize your typescript folder. To do so:
tsc --init
- this will generate a file called tsconfig.json
The documentation said to run code .
after you ran tsc --init
. Mine worked without is as well as with it. Feel free to play with it and see what it changes cause i honestly don't know.
After that, move your mouse up to the toolbar (global Terminal menu.)... underneath the Terminal tab, click on the Configure Default Build Task...
then click on tsc: build
and that will generate your tasks.json
Note that mine generated without the "version": "2.0.0" line... so if yours did the same that means your hardware is too old and you have to upgrade.... i'm kidding! ... Just add "version": "2.0.0",
right above "tasks": [
, and then you should be fine.
✌
You have to create it manually. Current version of VS Code only creates launch.json
automatically. The auto detect
claims made in docs also don't work (for me at least).
Here is a sample file you can create in .vscode/tasks.json
that defines gulpjs tasks:
{
"version":"0.1.0",
"command": "./node_modules/.bin/gulp",
"isShellCommand": true,
"tasks":[
{
"taskName": "test",
"isTestCommand": true,
"problemMatcher": "$gulp-tsc",
"showOutput": "always"
}
]
}
DANGER! All of this has changed. Current Microsoft docs on this topic are NOT consistent. Note the version warning at the top of this:
https://code.visualstudio.com/docs/editor/tasks
Note the conflicts between this:
https://docs.microsoft.com/en-us/visualstudio/ide/customize-build-and-debug-tasks-in-visual-studio?view=vs-2017
and this:
https://code.visualstudio.com/docs/languages/cpp
I cannot get a straight answer on what works now (12MAR2019) to save my life, but I can tell you that none of the permutations I've tried, namely:
{., .vs, .vscode} / { tasks.json, tasks.vs.json}
are working for me. It really drives me crazy that they changed this crap without updating ALL of the pertinent documentation, and the backward-compatibility "support" is just making things MUCH WORSE.