According to the API docs, a Message box can take a second argument: an array of strings which act as actions on the message box (which normally just has a single close button/action):
https://code.visualstudio.com/docs/extensionAPI/vscode-api#_window
showInformationMessage(message: string, ...items: string[]): Thenable<string>
So I tried this:
vscode.window.showInformationMessage('hello world', ['test','taco','cheeseburger'], function(value){
console.log(value + " was clicked");
});
But this doesn't seem to work. I get the message box along with a Close button like normal. But then to the left of the close button appears to be another single button with no text or title.
Another function definition is:
showInformationMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T>
So I tried something like this:
let message: vscode.MessageItem = { title: 'testing' };
vscode.window.showInformationMessage('hello', [message], function(value){
console.log(value + " was clicked");
});
But that doesn't seem to work either. There is a scarce amount of documentation on this so I cannot figure it out.
You can trigger IntelliSense in any editor window by typing Ctrl+Space or by typing a trigger character (such as the dot character (.)
The Click event is raised every time a control is double-clicked. For example, if you have event handlers for the Click and DoubleClick events of a Form, the Click and DoubleClick events are raised when the form is double-clicked and both methods are called.
vscode.window
.showInformationMessage('hello', 'test', 'taco', 'cheeseburger')
.then(selection => {
console.log(selection);
});
or
vscode.window
.showInformationMessage('hello', ...['test', 'taco', 'cheeseburger'])
.then(selection => {
console.log(selection);
});
Both result in a dialog that looks like this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With