Open elahehrashedi opened 4 years ago
@elahehrashedi there is no API for this. If there are any available tasks, we show only tasks and no tasks.json suggestions. The idea behind this is that generally, if folks go to Run a task, they mostly want to run tasks, and we shouldn't add more noise by offering an option to create a tasks.json. But when they get to the task list through Configure Task (which appears to be your second image), it's ok to add the extra information because they're asking for it.
Because of this, I don't want to add the option to create a tasks.json in the Run task menus. However, you might be able to do something like this by providing a Custom Execution task. With a Custom Execution, you provide a callback for the task and can easily use VS Code API to manually add a task to tasks.json (probably using the Configuration API since you can access tasks.json through there) and open tasks.json.
Do you think that might suit your needs?
I think the problem is with how cpptools registers its tasks. If we create our own task type like the sample does, then I think our issue is moot. We just want to make sure that the user has the opportunity to create a task from the default templates if there is no task.json
in the workspace, and it looks like this is possible with the code in the task provider sample.
Running the Tasks: Run Build Task command in C/C++ extension is providing the following tasks (when there is no build task is configured):
However, we want to add the below option so that the user is able to create tasks.json from the template:
Is there an API for Tasks: Run Build Task that we can modify in our extension? or is there a workaround to simulate a similar experience?