Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run task in tasks.json #216

Open
Yensan opened this issue Dec 7, 2017 · 5 comments
Open

How to run task in tasks.json #216

Yensan opened this issue Dec 7, 2017 · 5 comments

Comments

@Yensan
Copy link

Yensan commented Dec 7, 2017

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"}
},

@formulahendry
Copy link
Owner

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"
    }

@Yensan
Copy link
Author

Yensan commented Dec 7, 2017

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! 😆

@siyueyinghua
Copy link

siyueyinghua commented Dec 15, 2020

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: microsoft/vscode#45980 ?

@user-name-is-taken
Copy link

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

@chiqui3d
Copy link

chiqui3d commented May 2, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants