Fork from vscode-runonsave
Simplify original extension by pass command into Terminal directly without spawn process, so we don't lose output colors.
Add "saveAndRun" configuration to user or workspace settings.
Command + Shift + R
"saveAndRun": {
"commands": [
{
"match": ".*",
"cmd": "echo 'I run for all files.'",
"useShortcut": false,
"silent": false
},
{
"match": "\\.txt$",
"cmd": "echo 'I am a .txt file ${file}.'",
"useShortcut": false,
"silent": false
}
]
}
The following commands are exposed in the command palette
Save and Run : Enable
Save and Run : Disable
Commands support placeholders similar to tasks.json.
${workspaceRoot}
- workspace root folder${workspaceFolder}
- the path of the folder opened in VS Code${file}
- path of saved file${relativeFile}
- relative path of saved file${fileBasename}
- saved file's basename${fileDirname}
- directory name of saved file${fileExtname}
- extension (including .) of saved file${fileBasenameNoExt}
- saved file's basename without extension${cwd}
- current working directory${env.Name}