Acodex plugin Is required to use this extension
Acode plugin for running code directly from acode
let runner = acode.require("code.runner");
// Function Handler
runner.addHandler({
name: "python", extension: "py",
match: "*.py", handler(file) {
if (useIpython) {
return `cd $dir && ipython ${file.name}`
} else {
return `cd $dir && python ${file.name}`
}
}
})
// String handler
runner.addHandler({
name: "javascript",
extension: "js",
command: "node $path"
})
// Remove handlers.
runner.removeHandler("javascipt");
runner.addHandler({
name: "NPM",
match(file) {
return file.name == "package.json";
},
handler(file) {
return "npm run"
}
})
runner.addHandler
accepts an object with the following keys:
name
: Name to be displayed if multiple handlers are found.
extension
: File extension (optional).
match
: Regex string or function (sync or async) to be matched with the file name or called with the file.
handler
: Function (sync or async) called with editorManagee.activeFile
, which should return the command (string).
command
: String command used to run the file.
"$name" -> File name
"$nameNoExt" -> Name without extension
"$dir" -> File Absolute Directory
"$dirNoSlash" -> File Directory without ending slash
"$uri" -> File Uri
"$workspaceUrl" -> Folder amongst open folders which the file belongs to.
v1.0.2
v1.0.3, v1.0.4
v1.0.5
v1.0.6
v1.0.7
v1.0.8, 1.0.9