Debugging & Tasks
Tasks
Turn a shell command your project needs, such as build, lint, test, or watch, into something you can run with a click, a shortcut, or automatically.
What a task is
A task gives a terminal command a name. Instead of retyping npm run build
(or whatever your project uses), you run Tasks: Run Task → build from
the Command Palette, bind it to a shortcut, or have it run when you open
the folder.
Generate tasks automatically
Run Tasks: Configure Task. Gyaanmitra looks for a package.json, a
Makefile, or something similar, and offers tasks for the scripts it
finds.
Customize in tasks.json
Adjust anything it generated, or write your own, in .vscode/tasks.json.
Run it
Ctrl+Shift+B runs your project's default build task. Anything else goes through Tasks: Run Task.
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "npm run build",
"group": { "kind": "build", "isDefault": true },
"problemMatcher": ["$tsc"]
}
]
}Auto-detection
Gyaanmitra can find tasks in common project files before you write
tasks.json:
- npm / yarn / pnpm: scripts in
package.json(the npm extension) - Gulp, Grunt, Jake: tasks defined in their usual config files
- TypeScript / make: when those tools are present in the folder
Run Tasks: Configure Task and pick from the list, or run a detected
task from Tasks: Run Task. Scripts named build, compile, or watch
are treated as build tasks by default.
Problem matchers
The problemMatcher field turns raw command output into clickable rows in
the Problems panel. A TypeScript compiler error becomes a link to the
file and line, so you do not have to parse the terminal text yourself.
Gyaanmitra includes matchers for common compilers and linters. Point yours
at $tsc, $eslint-stylish, or a custom pattern for anything else.
Background and watch tasks
Mark a long-running task (a dev server, a file watcher) with
"isBackground": true. Gyaanmitra then does not wait for it to exit before
treating it as started. It watches the output for a pattern (set with
problemMatcher.background) that means the task is ready.
Run a task automatically on folder open
Set "runOptions": { "runOn": "folderOpen" } on a task, such as a dev
server or a file watcher, and it starts when you open the project.
Tasks and Gyaanmitra AI
Gyaanmitra AI can run any task the same way it runs a terminal command. Ask it to run the build and fix any errors. It will start the task, read the Problems panel, and keep going.