To Run Code
To Run Code
To Run Code
To run custom command, then use shortcut Ctrl+Alt+K, or press F1 and then
select/type Run Custom Command
Configuration
Make sure the executor PATH of each language is set in the environment variable.
You could also add entry into code-runner.executorMap to set the executor PATH.
e.g. To set the executor PATH for ruby, php and html:
{
"code-runner.executorMap": {
"javascript": "node",
"php": "C:\\php\\php.exe",
"python": "python",
"perl": "perl",
"ruby": "C:\\Ruby23-x64\\bin\\ruby.exe",
"go": "go run",
"html": "\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\
chrome.exe\"",
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt &&
$dir$fileNameWithoutExt"
}
}
{
"code-runner.defaultLanguage": "javascript"
}
For the default language: It should be set with language id defined in VS Code. The
languages you could set are java, c, cpp, javascript, php, python, perl, ruby, go,
lua, groovy, powershell, bat, shellscript, fsharp, csharp, vbscript, typescript,
coffeescript, swift, r, clojure, haxe, objective-c, rust, racket, ahk, autoit,
kotlin, dart, pascal, haskell, nim, d, lisp
{
"code-runner.executorMapByFileExtension": {
".vbs": "cscript //Nologo"
}
}
{
"code-runner.customCommand": "echo Hello"
}
{
"code-runner.cwd": "path/to/working/directory"
}
To set whether to clear previous output before each run (default is false):
{
"code-runner.clearPreviousOutput": false
}
{
"code-runner.saveAllFilesBeforeRun": false
}
To set whether to save the current file before running (default is false):
{
"code-runner.saveFileBeforeRun": false
}
To set whether to show extra execution message like [Running] ... and [Done] ...
(default is true):
{
"code-runner.showExecutionMessage": true
}
[REPL support] To set whether to run code in Integrated Terminal (only support to
run whole file in Integrated Terminal, neither untitled file nor code snippet)
(default is false):
{
"code-runner.runInTerminal": false
}
To set whether to preserve focus on code editor after code run is triggered
(default is true, the code editor will keep focus; when it is false, Terminal or
Output Channel will take focus):
{
"code-runner.preserveFocus": true
}
{
"code-runner.enableAppInsights": false
}
Change Log
See Change Log here
Issues
Submit the issues if you find any bug or have any suggestion.
Contribution
Fork the repo and submit pull requests.