mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 14:31:31 +01:00
show message source in title, #21302
This commit is contained in:
@@ -9,32 +9,35 @@ import { IMessageService, IChoiceService } from 'vs/platform/message/common/mess
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { TPromise as Promise } from 'vs/base/common/winjs.base';
|
||||
import { MainThreadMessageServiceShape, MainContext, IExtHostContext } from '../node/extHost.protocol';
|
||||
import * as vscode from 'vscode';
|
||||
import { MainThreadMessageServiceShape, MainContext, IExtHostContext, MainThreadMessageOptions } from '../node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers";
|
||||
import { IExtensionService } from "vs/platform/extensions/common/extensions";
|
||||
|
||||
@extHostNamedCustomer(MainContext.MainThreadMessageService)
|
||||
export class MainThreadMessageService implements MainThreadMessageServiceShape {
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@IChoiceService private _choiceService: IChoiceService
|
||||
@IExtensionService private readonly _extensionService: IExtensionService,
|
||||
@IMessageService private readonly _messageService: IMessageService,
|
||||
@IChoiceService private readonly _choiceService: IChoiceService
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
dispose(): void {
|
||||
//
|
||||
}
|
||||
|
||||
$showMessage(severity: Severity, message: string, options: vscode.MessageOptions, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Thenable<number> {
|
||||
$showMessage(severity: Severity, message: string, options: MainThreadMessageOptions, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Thenable<number> {
|
||||
if (options.modal) {
|
||||
return this.showModalMessage(severity, message, commands);
|
||||
return this._showModalMessage(severity, message, commands);
|
||||
} else {
|
||||
return this.showMessage(severity, message, commands);
|
||||
return this._showMessage(severity, message, commands, options.extensionId);
|
||||
}
|
||||
}
|
||||
|
||||
private showMessage(severity: Severity, message: string, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Thenable<number> {
|
||||
private _showMessage(severity: Severity, message: string, commands: { title: string; isCloseAffordance: boolean; handle: number; }[], extensionId: string): Thenable<number> {
|
||||
|
||||
return new Promise<number>(resolve => {
|
||||
|
||||
@@ -68,12 +71,13 @@ export class MainThreadMessageService implements MainThreadMessageServiceShape {
|
||||
|
||||
messageHide = this._messageService.show(severity, {
|
||||
message,
|
||||
actions
|
||||
actions,
|
||||
source: extensionId
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private showModalMessage(severity: Severity, message: string, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Thenable<number> {
|
||||
private _showModalMessage(severity: Severity, message: string, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Thenable<number> {
|
||||
let cancelId: number | undefined = void 0;
|
||||
|
||||
const options = commands.map((command, index) => {
|
||||
|
||||
Reference in New Issue
Block a user