This repository has been archived by the owner on Jul 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
commands
Marcel Kloubert edited this page Apr 21, 2017
·
12 revisions
Defines one or more commands that should be available in VS Code.
{
"deploy": {
"commands": [
{
"command": "mkloubert.mycommand",
"script": "./my-script.js",
"options": {
"MK": 23979,
"TM": "5979"
},
"button": {
"text": "My command",
"tooltip": "An optional button for the command"
}
}
]
}
}
Name | Description |
---|---|
button |
Settings for optional button in the status bar. |
command |
The ID of the command. |
options |
Optional data for the execution. |
script *
|
The path of the script that is executed when command is invoked. |
* supports placeholders
Name | Description |
---|---|
color *
|
The custom (text) color for the button. Default #ffffff
|
isRight |
Set button on the right side or not. Default (false)
|
priority |
The custom priority. |
show |
Show button on startup or not. Default (true)
|
text *
|
The caption for the button. |
tooltip *
|
The tooltip for the button. |
* supports placeholders
exports.execute = function(args) {
return new Promise(function(resolve, reject) {
try {
// s. https://code.visualstudio.com/Docs/extensionAPI/vscode-api
var vscode = args.require('vscode');
vscode.window.showInformationMessage('Hello, TM: ' + args.options.TM);
vscode.window.showInformationMessage('Hello, MK: ' + args.options.MK);
// this property can be used to store
// data for this command only
//
// this data will be available at the next execution(s)
// while the current session
args.commandState = 22121986;
// this property can be used to store
// data for this command and all the others commands
// registrated by that extension
//
// this data will be available at the next execution(s)
// while the current session
//
// HINT: the 'globalState' itself cannot be changed, but its properties!
args.globalState.mycommand = 171081;
resolve(666); // 666 is the optional
// result of the command
}
catch (e) {
reject(e);
}
});
// you also can return the result
// directly instead of using a Promise
// if your command runs SYNC
}