Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)

* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463

* fix config changes

* fix strictnull checks
This commit is contained in:
Anthony Dresser
2019-09-15 22:38:26 -07:00
committed by GitHub
parent fa6c52699e
commit ea0f9e6ce9
1226 changed files with 21541 additions and 17633 deletions

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { IDialogService, IDialogOptions, IConfirmation, IConfirmationResult, DialogType } from 'vs/platform/dialogs/common/dialogs';
import { IDialogService, IDialogOptions, IConfirmation, IConfirmationResult, DialogType, IShowResult } from 'vs/platform/dialogs/common/dialogs';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
import { ILogService } from 'vs/platform/log/common/log';
import Severity from 'vs/base/common/severity';
@@ -17,7 +17,7 @@ import { EventHelper } from 'vs/base/browser/dom';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
export class DialogService implements IDialogService {
_serviceBrand: any;
_serviceBrand: undefined;
private allowableCommands = ['copy', 'cut'];
@@ -78,7 +78,7 @@ export class DialogService implements IDialogService {
return (severity === Severity.Info) ? 'question' : (severity === Severity.Error) ? 'error' : (severity === Severity.Warning) ? 'warning' : 'none';
}
async show(severity: Severity, message: string, buttons: string[], options?: IDialogOptions): Promise<number> {
async show(severity: Severity, message: string, buttons: string[], options?: IDialogOptions): Promise<IShowResult> {
this.logService.trace('DialogService#show', message);
const dialogDisposables = new DisposableStore();
@@ -97,7 +97,9 @@ export class DialogService implements IDialogService {
EventHelper.stop(event, true);
}
}
}
},
checkboxLabel: options && options.checkbox ? options.checkbox.label : undefined,
checkboxChecked: options && options.checkbox ? options.checkbox.checked : undefined
});
dialogDisposables.add(dialog);
@@ -106,6 +108,9 @@ export class DialogService implements IDialogService {
const result = await dialog.show();
dialogDisposables.dispose();
return result.button;
return {
choice: result.button,
checkboxChecked: result.checkboxChecked
};
}
}

View File

@@ -41,6 +41,22 @@ export interface IConfirmationResult {
checkboxChecked?: boolean;
}
export interface IShowResult {
/**
* Selected choice index. If the user refused to choose,
* then a promise with index of `cancelId` option is returned. If there is no such
* option then promise with index `0` is returned.
*/
choice: number;
/**
* This will only be defined if the confirmation was created
* with the checkbox option defined.
*/
checkboxChecked?: boolean;
}
export interface IPickAndOpenOptions {
forceNewWindow?: boolean;
defaultUri?: URI;
@@ -127,8 +143,10 @@ export const IDialogService = createDecorator<IDialogService>('dialogService');
export interface IDialogOptions {
cancelId?: number;
detail?: string;
checkboxLabel?: string;
checkboxChecked?: boolean;
checkbox?: {
label: string;
checked?: boolean;
};
}
/**
@@ -139,7 +157,7 @@ export interface IDialogOptions {
*/
export interface IDialogService {
_serviceBrand: any;
_serviceBrand: undefined;
/**
* Ask the user for confirmation with a modal dialog.
@@ -153,7 +171,7 @@ export interface IDialogService {
* then a promise with index of `cancelId` option is returned. If there is no such
* option then promise with index `0` is returned.
*/
show(severity: Severity, message: string, buttons: string[], options?: IDialogOptions): Promise<number>;
show(severity: Severity, message: string, buttons: string[], options?: IDialogOptions): Promise<IShowResult>;
}
export const IFileDialogService = createDecorator<IFileDialogService>('fileDialogService');
@@ -163,7 +181,7 @@ export const IFileDialogService = createDecorator<IFileDialogService>('fileDialo
*/
export interface IFileDialogService {
_serviceBrand: any;
_serviceBrand: undefined;
/**
* The default path for a new file based on previously used files.

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
import { IDialogService, IConfirmation, IConfirmationResult } from 'vs/platform/dialogs/common/dialogs';
import { IDialogService, IConfirmation, IConfirmationResult, IShowResult } from 'vs/platform/dialogs/common/dialogs';
import Severity from 'vs/base/common/severity';
import { Event } from 'vs/base/common/event';
@@ -27,15 +27,15 @@ export class DialogChannel implements IServerChannel {
export class DialogChannelClient implements IDialogService {
_serviceBrand: any;
_serviceBrand: undefined;
constructor(private channel: IChannel) { }
show(severity: Severity, message: string, options: string[]): Promise<number> {
show(severity: Severity, message: string, options: string[]): Promise<IShowResult> {
return this.channel.call('show', [severity, message, options]);
}
confirm(confirmation: IConfirmation): Promise<IConfirmationResult> {
return this.channel.call('confirm', [confirmation]);
}
}
}