API docs によると、メッセージ ボックスは 2 番目の引数を取ることができます: メッセージ ボックスのアクションとして機能する文字列の配列 (通常、閉じるボタン/アクションは 1 つだけです):
https://code.visualstudio.com/docs/extensionAPI/vscode-api#_window
showInformationMessage(message: string, ...items: string[]): Thenable<string>
だから私はこれを試しました:
vscode.window.showInformationMessage('hello world', ['test','taco','cheeseburger'], function(value){
console.log(value + " was clicked");
});
しかし、これはうまくいかないようです。通常どおり、メッセージ ボックスと [閉じる] ボタンが表示されます。しかし、閉じるボタンの左側には、テキストやタイトルのない別の単一のボタンが表示されます。
別の関数定義は次のとおりです。
showInformationMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T>
だから私はこのようなことを試しました:
let message: vscode.MessageItem = { title: 'testing' };
vscode.window.showInformationMessage('hello', [message], function(value){
console.log(value + " was clicked");
});
しかし、それもうまくいかないようです。これに関するドキュメントはほとんどないので、私はそれを理解することができません。