vscode-code-runner
vscode-code-runner copied to clipboard
How to run task in tasks.json
I write some C code, if I want to run the code, must compile files or make the project. So, I write the tasks.json. But, how to use task.json and set these dependsOn task in settings.json for code-runner?
{"label": "VC_Compile", "group": "build", "windows": {"command": "call", "args": [""C:/Program Files (x86)/Microsoft Visual C++ Build Tools/vcbuildtools.bat"", "X86", "&& cd /d ${workspaceRoot}", "&& cl /W4 /EHsc /Ox /GL /source-charset:utf-8 /DNDEBUG /MT", "-IC:/Python3632/include", "/Fd:out/ /Fo:out/ ${file}", "/link", "/LIBPATH:C:/Python3632/libs /LIBPATH:C:/Python3632/PCbuild/win32", "/out:out/${fileBasenameNoExtension}.out"]}, "type": "shell", "problemMatcher": ["$tsc"], "dependsOn": "clear_o_files", "presentation": {"echo": true, "reveal": "always", "focus": false, "panel": "shared"} },
Hi @Yensan , Code Runner has no relation to the tasks.json, what you need is to update code-runner.executorMap
, https://github.com/formulahendry/vscode-code-runner#configuration
"code-runner.executorMap": {
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt && balabalala"
}
Hi, @formulahendry , thank you for answer. I know, but I want to relate them.
Because compile/build is a complex task, it is not so convenient to write in code-runner.executorMap
, because it is just One Line to write! :laughing:
I am also curious about this feature, and i think it is useful. I think maybe this can be realized by calling the task APIs of VS: https://github.com/Microsoft/vscode/issues/45980 ?
A good solution to this would be to run the task with the code
command from settings.json but it looks like the code command can't run tasks
So it is not possible to run a task from code-runner.executormap? Or at least be able to show the tasks in the context menu of the editor?