I want to create a VSCode extension that generate a shell task, like shell task with additional generic properties.
Example:
When user choose a task (my specific task that the extension is providing )
A
task.json
is generated automatically like
"tasks": [
{
"label": "mytask",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"command": "Invoke-Build -Task . -File './test'"
},
I try to VSCode samples repo however I didn't manage to do it, The file is generated just if you click ctrl+shift+p
and click on configure task button , which creates for you the tasks json.
I want it be automatically with my json entry above. how I can do that ?
In the following link there is several of option that you can providing a task (manually...I need it generated from extension) https://code.visualstudio.com/docs/editor/tasks
I basically need the code which generate a new task in task.json
file
If there is a reference where the code of creating a new tasks.json file maybe it can give a idea
https://github.com/microsoft/vscode/search?p=2&q=tasks.json&unscoped_q=tasks.json
There is another option which is to check if there is a tasks.json
file , if not generate new one and add a new entry to the tasks array,(using my code not vscode api ) , but is it a good solution ?