mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-26 10:16:01 +01:00
notifications - extract choice/confirm service from message service
This commit is contained in:
@@ -146,6 +146,10 @@
|
||||
"name": "vs/workbench/services/crashReporter",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/dialogs",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/editor",
|
||||
"project": "vscode-workbench"
|
||||
|
||||
@@ -30,8 +30,6 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper
|
||||
import { TelemetryAppenderChannel } from 'vs/platform/telemetry/common/telemetryIpc';
|
||||
import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
|
||||
import { IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { ChoiceChannelClient } from 'vs/platform/message/common/messageIpc';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { WindowsChannelClient } from 'vs/platform/windows/common/windowsIpc';
|
||||
import { ipcRenderer } from 'electron';
|
||||
@@ -43,6 +41,8 @@ import { LogLevelSetterChannelClient, FollowerLogService } from 'vs/platform/log
|
||||
import { LocalizationsService } from 'vs/platform/localizations/node/localizations';
|
||||
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
|
||||
import { LocalizationsChannel } from 'vs/platform/localizations/common/localizationsIpc';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { ChoiceChannelClient } from 'vs/platform/dialogs/common/choiceIpc';
|
||||
|
||||
export interface ISharedProcessConfiguration {
|
||||
readonly machineId: string;
|
||||
|
||||
@@ -47,9 +47,9 @@ import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
|
||||
import { printDiagnostics } from 'vs/code/electron-main/diagnostics';
|
||||
import { BufferLogService } from 'vs/platform/log/common/bufferLog';
|
||||
import { uploadLogs } from 'vs/code/electron-main/logUploader';
|
||||
import { IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { ChoiceCliService } from 'vs/platform/message/node/messageCli';
|
||||
import { setUnexpectedErrorHandler } from 'vs/base/common/errors';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { ChoiceCliService } from 'vs/platform/dialogs/node/choiceCli';
|
||||
|
||||
function createServices(args: ParsedArgs, bufferLogService: BufferLogService): IInstantiationService {
|
||||
const services = new ServiceCollection();
|
||||
|
||||
@@ -30,14 +30,14 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||
import { ConfigurationService } from 'vs/platform/configuration/node/configurationService';
|
||||
import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
|
||||
import { mkdirp, writeFile } from 'vs/base/node/pfs';
|
||||
import { IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { ChoiceCliService } from 'vs/platform/message/node/messageCli';
|
||||
import { getBaseLabel } from 'vs/base/common/labels';
|
||||
import { IStateService } from 'vs/platform/state/common/state';
|
||||
import { StateService } from 'vs/platform/state/node/stateService';
|
||||
import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
|
||||
import { ILogService, getLogLevel } from 'vs/platform/log/common/log';
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { ChoiceCliService } from 'vs/platform/dialogs/node/choiceCli';
|
||||
|
||||
const notFound = (id: string) => localize('notFound', "Extension '{0}' not found.", id);
|
||||
const notInstalled = (id: string) => localize('notInstalled', "Extension '{0}' is not installed.", id);
|
||||
|
||||
@@ -17,7 +17,7 @@ import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayo
|
||||
import { KeybindingResolver } from 'vs/platform/keybinding/common/keybindingResolver';
|
||||
import { IKeybindingEvent, KeybindingSource, IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IConfirmation, IMessageService, IConfirmationResult } from 'vs/platform/message/common/message';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IWorkspaceContextService, IWorkspace, WorkbenchState, IWorkspaceFolder, IWorkspaceFoldersChangeEvent, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { ICodeEditor, IDiffEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
@@ -40,6 +40,7 @@ import { OS } from 'vs/base/common/platform';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { INotificationService, INotification, INotificationHandle, NoOpNotification } from 'vs/platform/notification/common/notification';
|
||||
import { IConfirmation, IConfirmationResult, IConfirmationService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
export class SimpleEditor implements IEditor {
|
||||
|
||||
@@ -261,6 +262,11 @@ export class SimpleMessageService implements IMessageService {
|
||||
public hideAll(): void {
|
||||
// No-op
|
||||
}
|
||||
}
|
||||
|
||||
export class SimpleConfirmationService implements IConfirmationService {
|
||||
|
||||
public _serviceBrand: any;
|
||||
|
||||
public confirm(confirmation: IConfirmation): TPromise<boolean> {
|
||||
let messageText = confirmation.message;
|
||||
|
||||
@@ -34,7 +34,7 @@ import { CodeEditorServiceImpl } from 'vs/editor/browser/services/codeEditorServ
|
||||
import {
|
||||
SimpleConfigurationService, SimpleResourceConfigurationService, SimpleMenuService, SimpleMessageService,
|
||||
SimpleProgressService, StandaloneCommandService, StandaloneKeybindingService, SimpleNotificationService,
|
||||
StandaloneTelemetryService, SimpleWorkspaceContextService
|
||||
StandaloneTelemetryService, SimpleWorkspaceContextService, SimpleConfirmationService
|
||||
} from 'vs/editor/standalone/browser/simpleServices';
|
||||
import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService';
|
||||
import { IMenuService } from 'vs/platform/actions/common/actions';
|
||||
@@ -42,6 +42,7 @@ import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneT
|
||||
import { StandaloneThemeServiceImpl } from 'vs/editor/standalone/browser/standaloneThemeServiceImpl';
|
||||
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IConfirmationService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
export interface IEditorContextViewService extends IContextViewService {
|
||||
dispose(): void;
|
||||
@@ -128,6 +129,8 @@ export module StaticServices {
|
||||
|
||||
export const messageService = define(IMessageService, () => new SimpleMessageService());
|
||||
|
||||
export const confirmationService = define(IConfirmationService, () => new SimpleConfirmationService());
|
||||
|
||||
export const notificationService = define(INotificationService, () => new SimpleNotificationService());
|
||||
|
||||
export const markerService = define(IMarkerService, () => new MarkerService());
|
||||
|
||||
+2
-1
@@ -7,7 +7,8 @@
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IChoiceService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { Severity } from 'vs/platform/message/common/message';
|
||||
|
||||
export interface IChoiceChannel extends IChannel {
|
||||
call(command: 'choose'): TPromise<number>;
|
||||
@@ -0,0 +1,66 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export interface IConfirmation {
|
||||
title?: string;
|
||||
type?: 'none' | 'info' | 'error' | 'question' | 'warning';
|
||||
message: string;
|
||||
detail?: string;
|
||||
primaryButton?: string;
|
||||
secondaryButton?: string;
|
||||
checkbox?: {
|
||||
label: string;
|
||||
checked?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IConfirmationResult {
|
||||
confirmed: boolean;
|
||||
checkboxChecked?: boolean;
|
||||
}
|
||||
|
||||
export const IConfirmationService = createDecorator<IConfirmationService>('confirmationService');
|
||||
|
||||
export interface IConfirmationService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
/**
|
||||
* Ask the user for confirmation.
|
||||
*/
|
||||
confirm(confirmation: IConfirmation): TPromise<boolean>;
|
||||
|
||||
/**
|
||||
* Ask the user for confirmation with a checkbox.
|
||||
*/
|
||||
confirmWithCheckbox(confirmation: IConfirmation): TPromise<IConfirmationResult>;
|
||||
}
|
||||
|
||||
export const IChoiceService = createDecorator<IChoiceService>('choiceService');
|
||||
|
||||
export interface IChoiceService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
/**
|
||||
* Prompt the user for a choice between multiple options.
|
||||
*
|
||||
* @param when `modal` is true, this will block the user until chooses.
|
||||
*
|
||||
* @returns A promise with the selected choice index. The promise is cancellable
|
||||
* which hides the message. The promise can return an error, meaning that
|
||||
* the user refused to choose.
|
||||
*
|
||||
* When `modal` is true and user refused to choose, then promise with index of
|
||||
* `Cancel` option is returned. If there is no such option then promise with
|
||||
* `0` index is returned.
|
||||
*/
|
||||
choose(severity: Severity, message: string, options: string[], cancelId: number, modal?: boolean): TPromise<number>;
|
||||
}
|
||||
+2
-1
@@ -5,7 +5,8 @@
|
||||
|
||||
import * as readline from 'readline';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IChoiceService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { Severity } from 'vs/platform/message/common/message';
|
||||
|
||||
export class ChoiceCliService implements IChoiceService {
|
||||
|
||||
@@ -29,11 +29,12 @@ import { Limiter } from 'vs/base/common/async';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import * as semver from 'semver';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IChoiceService, Severity } from 'vs/platform/message/common/message';
|
||||
import { Severity } from 'vs/platform/message/common/message';
|
||||
import pkg from 'vs/platform/node/package';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ExtensionsManifestCache } from 'vs/platform/extensionManagement/node/extensionsManifestCache';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
const SystemExtensionsRoot = path.normalize(path.join(URI.parse(require.toUrl('')).fsPath, '..', 'extensions'));
|
||||
const ERROR_SCANNING_SYS_EXTENSIONS = 'scanningSystem';
|
||||
|
||||
@@ -124,8 +124,6 @@ suite('AbstractKeybindingService', () => {
|
||||
let messageService: IMessageService = {
|
||||
_serviceBrand: undefined,
|
||||
hideAll: undefined,
|
||||
confirm: undefined,
|
||||
confirmWithCheckbox: undefined,
|
||||
show: (sev: Severity, message: any): () => void => {
|
||||
showMessageCalls.push({
|
||||
sev: sev,
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
'use strict';
|
||||
|
||||
import nls = require('vs/nls');
|
||||
import uri from 'vs/base/common/uri';
|
||||
import paths = require('vs/base/common/paths');
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -18,48 +16,12 @@ export interface IMessageWithAction {
|
||||
source?: string;
|
||||
}
|
||||
|
||||
export interface IConfirmation {
|
||||
title?: string;
|
||||
type?: 'none' | 'info' | 'error' | 'question' | 'warning';
|
||||
message: string;
|
||||
detail?: string;
|
||||
primaryButton?: string;
|
||||
secondaryButton?: string;
|
||||
checkbox?: {
|
||||
label: string;
|
||||
checked?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export const CloseAction = new Action('close.message', nls.localize('close', "Close"), null, true, () => TPromise.as(true));
|
||||
export const LaterAction = new Action('later.message', nls.localize('later', "Later"), null, true, () => TPromise.as(true));
|
||||
export const CancelAction = new Action('cancel.message', nls.localize('cancel', "Cancel"), null, true, () => TPromise.as(true));
|
||||
|
||||
export const IMessageService = createDecorator<IMessageService>('messageService');
|
||||
|
||||
const MAX_CONFIRM_FILES = 10;
|
||||
export function getConfirmMessage(start: string, resourcesToConfirm: uri[]): string {
|
||||
const message = [start];
|
||||
message.push('');
|
||||
message.push(...resourcesToConfirm.slice(0, MAX_CONFIRM_FILES).map(r => paths.basename(r.fsPath)));
|
||||
|
||||
if (resourcesToConfirm.length > MAX_CONFIRM_FILES) {
|
||||
if (resourcesToConfirm.length - MAX_CONFIRM_FILES === 1) {
|
||||
message.push(nls.localize('moreFile', "...1 additional file not shown"));
|
||||
} else {
|
||||
message.push(nls.localize('moreFiles', "...{0} additional files not shown", resourcesToConfirm.length - MAX_CONFIRM_FILES));
|
||||
}
|
||||
}
|
||||
|
||||
message.push('');
|
||||
return message.join('\n');
|
||||
}
|
||||
|
||||
export interface IConfirmationResult {
|
||||
confirmed: boolean;
|
||||
checkboxChecked?: boolean;
|
||||
}
|
||||
|
||||
export interface IMessageService {
|
||||
|
||||
_serviceBrand: any;
|
||||
@@ -78,38 +40,6 @@ export interface IMessageService {
|
||||
* Hide any messages showing currently.
|
||||
*/
|
||||
hideAll(): void;
|
||||
|
||||
/**
|
||||
* Ask the user for confirmation.
|
||||
*/
|
||||
confirm(confirmation: IConfirmation): TPromise<boolean>;
|
||||
|
||||
/**
|
||||
* Ask the user for confirmation with a checkbox.
|
||||
*/
|
||||
confirmWithCheckbox(confirmation: IConfirmation): TPromise<IConfirmationResult>;
|
||||
}
|
||||
|
||||
export const IChoiceService = createDecorator<IChoiceService>('choiceService');
|
||||
|
||||
export interface IChoiceService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
/**
|
||||
* Prompt the user for a choice between multiple options.
|
||||
*
|
||||
* @param when `modal` is true, this will block the user until chooses.
|
||||
*
|
||||
* @returns A promise with the selected choice index. The promise is cancellable
|
||||
* which hides the message. The promise can return an error, meaning that
|
||||
* the user refused to choose.
|
||||
*
|
||||
* When `modal` is true and user refused to choose, then promise with index of
|
||||
* `Cancel` option is returned. If there is no such option then promise with
|
||||
* `0` index is returned.
|
||||
*/
|
||||
choose(severity: Severity, message: string, options: string[], cancelId: number, modal?: boolean): TPromise<number>;
|
||||
}
|
||||
|
||||
export import Severity = Severity;
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
'use strict';
|
||||
|
||||
import nls = require('vs/nls');
|
||||
import { IMessageService, IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { MainThreadMessageServiceShape, MainContext, IExtHostContext, MainThreadMessageOptions } from '../node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
@extHostNamedCustomer(MainContext.MainThreadMessageService)
|
||||
export class MainThreadMessageService implements MainThreadMessageServiceShape {
|
||||
|
||||
@@ -54,8 +54,7 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
|
||||
import { ILifecycleService, LifecyclePhase, ShutdownReason, StartupKind } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IMarkerService } from 'vs/platform/markers/common/markers';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IMessageService, IChoiceService, Severity } from 'vs/platform/message/common/message';
|
||||
import { ChoiceChannel } from 'vs/platform/message/common/messageIpc';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { ISearchService } from 'vs/platform/search/common/search';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { CommandService } from 'vs/platform/commands/common/commandService';
|
||||
@@ -96,6 +95,9 @@ import { IWorkbenchIssueService } from 'vs/workbench/services/issue/common/issue
|
||||
import { WorkbenchIssueService } from 'vs/workbench/services/issue/electron-browser/workbenchIssueService';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { NotificationService } from 'vs/workbench/services/notification/common/notificationService';
|
||||
import { ChoiceChannel } from 'vs/platform/dialogs/common/choiceIpc';
|
||||
import { IChoiceService, IConfirmationService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { DialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogs';
|
||||
|
||||
/**
|
||||
* Services that we require for the Shell
|
||||
@@ -401,9 +403,12 @@ export class WorkbenchShell {
|
||||
}
|
||||
serviceCollection.set(ICrashReporterService, crashReporterService);
|
||||
|
||||
const dialog = instantiationService.createInstance(DialogService);
|
||||
serviceCollection.set(IChoiceService, dialog);
|
||||
serviceCollection.set(IConfirmationService, dialog);
|
||||
|
||||
this.messageService = instantiationService.createInstance(MessageService, container);
|
||||
serviceCollection.set(IMessageService, this.messageService);
|
||||
serviceCollection.set(IChoiceService, this.messageService);
|
||||
|
||||
const lifecycleService = instantiationService.createInstance(LifecycleService);
|
||||
this.toUnbind.push(lifecycleService.onShutdown(reason => this.dispose(reason)));
|
||||
|
||||
@@ -24,7 +24,7 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FileChangesEvent, FileChangeType, IFileService } from 'vs/platform/files/common/files';
|
||||
import { IMessageService, CloseAction, IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { IMessageService, CloseAction } from 'vs/platform/message/common/message';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
|
||||
@@ -52,6 +52,7 @@ import { IBroadcastService, IBroadcast } from 'vs/platform/broadcast/electron-br
|
||||
import { IRemoteConsoleLog, parse, getFirstFrame } from 'vs/base/node/console';
|
||||
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
|
||||
import { TaskEvent, TaskEventKind } from 'vs/workbench/parts/tasks/common/tasks';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint';
|
||||
const DEBUG_BREAKPOINTS_ACTIVATED_KEY = 'debug.breakpointactivated';
|
||||
|
||||
@@ -15,7 +15,7 @@ import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import product from 'vs/platform/node/product';
|
||||
import { IChoiceService, IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ShowRecommendedExtensionsAction, InstallWorkspaceRecommendedExtensionsAction, InstallRecommendedExtensionAction } from 'vs/workbench/parts/extensions/browser/extensionsActions';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
@@ -36,6 +36,7 @@ import { getHashedRemotesFromUri } from 'vs/workbench/parts/stats/node/workspace
|
||||
import { IRequestService } from 'vs/platform/request/node/request';
|
||||
import { asJson } from 'vs/base/node/request';
|
||||
import { isNumber } from 'vs/base/common/types';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
interface IExtensionsContent {
|
||||
recommendations: string[];
|
||||
|
||||
@@ -18,10 +18,11 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IMessageService, Severity, IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { BetterMergeDisabledNowKey, BetterMergeId, areSameExtensions, adoptToGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { getIdAndVersionFromLocalExtensionId } from 'vs/platform/extensionManagement/node/extensionManagementUtil';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
export interface IExtensionStatus {
|
||||
identifier: IExtensionIdentifier;
|
||||
|
||||
@@ -26,7 +26,7 @@ import { getGalleryExtensionIdFromLocal, getGalleryExtensionTelemetryData, getLo
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IChoiceService, IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IExtension, IExtensionDependencies, ExtensionState, IExtensionsWorkbenchService, AutoUpdateConfigurationKey } from 'vs/workbench/parts/extensions/common/extensions';
|
||||
@@ -36,6 +36,7 @@ import { ExtensionsInput } from 'vs/workbench/parts/extensions/common/extensions
|
||||
import product from 'vs/platform/node/product';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IProgressService2, ProgressLocation } from 'vs/platform/progress/common/progress';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
interface IExtensionStateProvider<T> {
|
||||
(extension: Extension): T;
|
||||
|
||||
+1
-1
@@ -42,11 +42,11 @@ import { ExtensionManagementService } from 'vs/platform/extensionManagement/node
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/parts/extensions/node/extensionsWorkbenchService';
|
||||
import { TestExtensionEnablementService } from 'vs/platform/extensionManagement/test/common/extensionEnablementService.test';
|
||||
import { IURLService } from 'vs/platform/url/common/url';
|
||||
import { IChoiceService } from 'vs/platform/message/common/message';
|
||||
import product from 'vs/platform/node/product';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
const mockExtensionGallery: IGalleryExtension[] = [
|
||||
aGalleryExtension('MockExtension1', {
|
||||
|
||||
+1
-1
@@ -30,12 +30,12 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { TestContextService, TestWindowService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IProgressService2 } from 'vs/platform/progress/common/progress';
|
||||
import { ProgressService2 } from 'vs/workbench/services/progress/browser/progressService2';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
suite('ExtensionsWorkbenchService Test', () => {
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IUntitledResourceInput } from 'vs/platform/editor/common/editor';
|
||||
import { IInstantiationService, ServicesAccessor, IConstructorSignature2 } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService, IMessageWithAction, IConfirmation, Severity, CancelAction, IConfirmationResult, getConfirmMessage } from 'vs/platform/message/common/message';
|
||||
import { IMessageService, IMessageWithAction, Severity, CancelAction } from 'vs/platform/message/common/message';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
@@ -53,6 +53,8 @@ import { IListService, ListWidget } from 'vs/platform/list/browser/listService';
|
||||
import { RawContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { distinctParents, basenameOrAuthority } from 'vs/base/common/resources';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IConfirmationService, IConfirmationResult, IConfirmation } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { getConfirmMessage } from 'vs/workbench/services/dialogs/electron-browser/dialogs';
|
||||
|
||||
export interface IEditableData {
|
||||
action: IAction;
|
||||
@@ -567,6 +569,7 @@ class BaseDeleteFileAction extends BaseFileAction {
|
||||
private useTrash: boolean,
|
||||
@IFileService fileService: IFileService,
|
||||
@IMessageService messageService: IMessageService,
|
||||
@IConfirmationService private confirmationService: IConfirmationService,
|
||||
@ITextFileService textFileService: ITextFileService,
|
||||
@IConfigurationService private configurationService: IConfigurationService
|
||||
) {
|
||||
@@ -611,7 +614,7 @@ class BaseDeleteFileAction extends BaseFileAction {
|
||||
message = nls.localize('dirtyMessageFileDelete', "You are deleting a file with unsaved changes. Do you want to continue?");
|
||||
}
|
||||
|
||||
confirmDirtyPromise = this.messageService.confirm({
|
||||
confirmDirtyPromise = this.confirmationService.confirm({
|
||||
message,
|
||||
type: 'warning',
|
||||
detail: nls.localize('dirtyWarning', "Your changes will be lost if you don't save them."),
|
||||
@@ -644,7 +647,7 @@ class BaseDeleteFileAction extends BaseFileAction {
|
||||
const message = distinctElements.length > 1 ? getConfirmMessage(nls.localize('confirmMoveTrashMessageMultiple', "Are you sure you want to delete the following {0} files?", distinctElements.length), distinctElements.map(e => e.resource))
|
||||
: distinctElements[0].isDirectory ? nls.localize('confirmMoveTrashMessageFolder', "Are you sure you want to delete '{0}' and its contents?", distinctElements[0].name)
|
||||
: nls.localize('confirmMoveTrashMessageFile', "Are you sure you want to delete '{0}'?", distinctElements[0].name);
|
||||
confirmDeletePromise = this.messageService.confirmWithCheckbox({
|
||||
confirmDeletePromise = this.confirmationService.confirmWithCheckbox({
|
||||
message,
|
||||
detail: isWindows ? nls.localize('undoBin', "You can restore from the recycle bin.") : nls.localize('undoTrash', "You can restore from the trash."),
|
||||
primaryButton,
|
||||
@@ -660,7 +663,7 @@ class BaseDeleteFileAction extends BaseFileAction {
|
||||
const message = distinctElements.length > 1 ? getConfirmMessage(nls.localize('confirmDeleteMessageMultiple', "Are you sure you want to permanently delete the following {0} files?", distinctElements.length), distinctElements.map(e => e.resource))
|
||||
: distinctElements[0].isDirectory ? nls.localize('confirmDeleteMessageFolder', "Are you sure you want to permanently delete '{0}' and its contents?", distinctElements[0].name)
|
||||
: nls.localize('confirmDeleteMessageFile', "Are you sure you want to permanently delete '{0}'?", distinctElements[0].name);
|
||||
confirmDeletePromise = this.messageService.confirmWithCheckbox({
|
||||
confirmDeletePromise = this.confirmationService.confirmWithCheckbox({
|
||||
message,
|
||||
detail: nls.localize('irreversible', "This action is irreversible!"),
|
||||
primaryButton,
|
||||
@@ -720,6 +723,7 @@ export class ImportFileAction extends BaseFileAction {
|
||||
clazz: string,
|
||||
@IFileService fileService: IFileService,
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@IConfirmationService private confirmationService: IConfirmationService,
|
||||
@IMessageService messageService: IMessageService,
|
||||
@ITextFileService textFileService: ITextFileService
|
||||
) {
|
||||
@@ -772,7 +776,7 @@ export class ImportFileAction extends BaseFileAction {
|
||||
type: 'warning'
|
||||
};
|
||||
|
||||
overwritePromise = this.messageService.confirm(confirm);
|
||||
overwritePromise = this.confirmationService.confirm(confirm);
|
||||
}
|
||||
|
||||
return overwritePromise.then(overwrite => {
|
||||
|
||||
@@ -38,7 +38,7 @@ import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configur
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService, IConfirmation, Severity, IConfirmationResult, getConfirmMessage } from 'vs/platform/message/common/message';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
@@ -58,6 +58,8 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
|
||||
import { DataTransfers } from 'vs/base/browser/dnd';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IConfirmationService, IConfirmationResult, IConfirmation } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { getConfirmMessage } from 'vs/workbench/services/dialogs/electron-browser/dialogs';
|
||||
|
||||
export class FileDataSource implements IDataSource {
|
||||
constructor(
|
||||
@@ -684,6 +686,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
|
||||
|
||||
constructor(
|
||||
@IMessageService private messageService: IMessageService,
|
||||
@IConfirmationService private confirmationService: IConfirmationService,
|
||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
||||
@IFileService private fileService: IFileService,
|
||||
@IConfigurationService private configurationService: IConfigurationService,
|
||||
@@ -858,7 +861,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
|
||||
// If we are in no-workspace context, ask for confirmation to create a workspace
|
||||
let confirmedPromise = TPromise.wrap(true);
|
||||
if (this.contextService.getWorkbenchState() !== WorkbenchState.WORKSPACE) {
|
||||
confirmedPromise = this.messageService.confirm({
|
||||
confirmedPromise = this.confirmationService.confirm({
|
||||
message: folders.length > 1 ? nls.localize('dropFolders', "Do you want to add the folders to the workspace?") : nls.localize('dropFolder', "Do you want to add the folder to the workspace?"),
|
||||
type: 'question',
|
||||
primaryButton: folders.length > 1 ? nls.localize('addFolders', "&&Add Folders") : nls.localize('addFolder', "&&Add Folder")
|
||||
@@ -894,7 +897,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
|
||||
// Handle confirm setting
|
||||
const confirmDragAndDrop = !isCopy && this.configurationService.getValue<boolean>(FileDragAndDrop.CONFIRM_DND_SETTING_KEY);
|
||||
if (confirmDragAndDrop) {
|
||||
confirmPromise = this.messageService.confirmWithCheckbox({
|
||||
confirmPromise = this.confirmationService.confirmWithCheckbox({
|
||||
message: sources.length > 1 ? getConfirmMessage(nls.localize('confirmMultiMove', "Are you sure you want to move the following {0} files?", sources.length), sources.map(s => s.resource))
|
||||
: nls.localize('confirmMove', "Are you sure you want to move '{0}'?", sources[0].name),
|
||||
checkbox: {
|
||||
@@ -1016,7 +1019,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
|
||||
};
|
||||
|
||||
// Move with overwrite if the user confirms
|
||||
return this.messageService.confirm(confirm).then(confirmed => {
|
||||
return this.confirmationService.confirm(confirm).then(confirmed => {
|
||||
if (confirmed) {
|
||||
const targetDirty = this.textFileService.getDirty().filter(d => resources.isEqualOrParent(d, targetResource, !isLinux /* ignorecase */));
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkbenchContributionsRegistry, IWorkbenchContribution, Extensions } from 'vs/workbench/common/contributions';
|
||||
@@ -19,12 +18,13 @@ import { join, dirname } from 'path';
|
||||
import { localize } from 'vs/nls';
|
||||
import { readdir, del, readFile } from 'vs/base/node/pfs';
|
||||
import { basename } from 'vs/base/common/paths';
|
||||
import { IConfirmationService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
class StartupProfiler implements IWorkbenchContribution {
|
||||
|
||||
constructor(
|
||||
@IWindowsService private readonly _windowsService: IWindowsService,
|
||||
@IMessageService private readonly _messageService: IMessageService,
|
||||
@IConfirmationService private readonly _confirmationService: IConfirmationService,
|
||||
@IEnvironmentService private readonly _environmentService: IEnvironmentService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService,
|
||||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@@ -59,7 +59,7 @@ class StartupProfiler implements IWorkbenchContribution {
|
||||
}).then(files => {
|
||||
const profileFiles = files.reduce((prev, cur) => `${prev}${join(dir, cur)}\n`, '\n');
|
||||
|
||||
return this._messageService.confirm({
|
||||
return this._confirmationService.confirm({
|
||||
type: 'info',
|
||||
message: localize('prof.message', "Successfully created profiles."),
|
||||
detail: localize('prof.detail', "Please create an issue and manually attach the following files:\n{0}", profileFiles),
|
||||
@@ -73,7 +73,7 @@ class StartupProfiler implements IWorkbenchContribution {
|
||||
action.run(`:warning: Make sure to **attach** these files from your *home*-directory: :warning:\n${files.map(file => `-\`${file}\``).join('\n')}`)
|
||||
]).then(() => {
|
||||
// keep window stable until restart is selected
|
||||
return this._messageService.confirm({
|
||||
return this._confirmationService.confirm({
|
||||
type: 'info',
|
||||
message: localize('prof.thanks', "Thanks for helping us."),
|
||||
detail: localize('prof.detail.restart', "A final restart is required to continue to use '{0}'. Again, thank you for your contribution.", this._environmentService.appNameLong),
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IWorkbenchContributionsRegistry, IWorkbenchContribution, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IWindowsService, IWindowService, IWindowsConfiguration } from 'vs/platform/windows/common/windows';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { localize } from 'vs/nls';
|
||||
@@ -20,6 +19,7 @@ import URI from 'vs/base/common/uri';
|
||||
import { isEqual } from 'vs/base/common/resources';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IConfirmationService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
interface IConfiguration extends IWindowsConfiguration {
|
||||
update: { channel: string; };
|
||||
@@ -47,7 +47,7 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution {
|
||||
@IWindowService private windowService: IWindowService,
|
||||
@IConfigurationService private configurationService: IConfigurationService,
|
||||
@IEnvironmentService private envService: IEnvironmentService,
|
||||
@IMessageService private messageService: IMessageService,
|
||||
@IConfirmationService private confirmationService: IConfirmationService,
|
||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
||||
@IExtensionService private extensionService: IExtensionService
|
||||
) {
|
||||
@@ -146,7 +146,7 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution {
|
||||
private doConfirm(message: string, detail: string, primaryButton: string, confirmed: () => void): void {
|
||||
this.windowService.isFocused().then(focused => {
|
||||
if (focused) {
|
||||
return this.messageService.confirm({
|
||||
return this.confirmationService.confirm({
|
||||
type: 'info',
|
||||
message,
|
||||
detail,
|
||||
|
||||
@@ -36,7 +36,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService, IConfirmation } from 'vs/platform/message/common/message';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
@@ -59,6 +59,7 @@ import { isDiffEditor, isCodeEditor, ICodeEditor } from 'vs/editor/browser/edito
|
||||
import { TreeResourceNavigator, WorkbenchTree } from 'vs/platform/list/browser/listService';
|
||||
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { SimpleFileResourceDragAndDrop } from 'vs/workbench/browser/dnd';
|
||||
import { IConfirmation, IConfirmationService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
export class SearchViewlet extends Viewlet {
|
||||
|
||||
@@ -109,6 +110,7 @@ export class SearchViewlet extends Viewlet {
|
||||
@IEditorGroupService private editorGroupService: IEditorGroupService,
|
||||
@IProgressService private progressService: IProgressService,
|
||||
@IMessageService private messageService: IMessageService,
|
||||
@IConfirmationService private confirmationService: IConfirmationService,
|
||||
@IStorageService private storageService: IStorageService,
|
||||
@IContextViewService private contextViewService: IContextViewService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@@ -395,7 +397,7 @@ export class SearchViewlet extends Viewlet {
|
||||
type: 'question'
|
||||
};
|
||||
|
||||
this.messageService.confirm(confirmation).then(confirmed => {
|
||||
this.confirmationService.confirm(confirmation).then(confirmed => {
|
||||
if (confirmed) {
|
||||
this.searchWidget.setReplaceAllActionState(false);
|
||||
this.viewModel.searchResult.replaceAll(progressRunner).then(() => {
|
||||
|
||||
@@ -32,7 +32,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IMessageService, IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IMarkerService, MarkerStatistics } from 'vs/platform/markers/common/markers';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
@@ -500,7 +500,8 @@ class TaskService implements ITaskService {
|
||||
@IStorageService private storageService: IStorageService,
|
||||
@IProgressService2 private progressService: IProgressService2,
|
||||
@IOpenerService private openerService: IOpenerService,
|
||||
@IWindowService private readonly _windowServive: IWindowService
|
||||
@IWindowService private readonly _windowServive: IWindowService,
|
||||
@IConfirmationService private confirmationService: IConfirmationService
|
||||
) {
|
||||
this.configurationService = configurationService;
|
||||
this.markerService = markerService;
|
||||
@@ -1671,7 +1672,7 @@ class TaskService implements ITaskService {
|
||||
if (this._taskSystem.canAutoTerminate()) {
|
||||
terminatePromise = TPromise.wrap(true);
|
||||
} else {
|
||||
terminatePromise = this.messageService.confirm({
|
||||
terminatePromise = this.confirmationService.confirm({
|
||||
message: nls.localize('TaskSystem.runningTask', 'There is a task running. Do you want to terminate it?'),
|
||||
primaryButton: nls.localize({ key: 'TaskSystem.terminateTask', comment: ['&& denotes a mnemonic'] }, "&&Terminate Task"),
|
||||
type: 'question'
|
||||
@@ -1696,7 +1697,7 @@ class TaskService implements ITaskService {
|
||||
this.disposeTaskSystemListeners();
|
||||
return false; // no veto
|
||||
} else if (code && code === TerminateResponseCode.ProcessNotFound) {
|
||||
return this.messageService.confirm({
|
||||
return this.confirmationService.confirm({
|
||||
message: nls.localize('TaskSystem.noProcess', 'The launched task doesn\'t exist anymore. If the task spawned background processes exiting VS Code might result in orphaned processes. To avoid this start the last background process with a wait flag.'),
|
||||
primaryButton: nls.localize({ key: 'TaskSystem.exitAnyways', comment: ['&& denotes a mnemonic'] }, "&&Exit Anyways"),
|
||||
type: 'info'
|
||||
@@ -2412,6 +2413,7 @@ let schema: IJSONSchema = {
|
||||
|
||||
import schemaVersion1 from './jsonSchema_v1';
|
||||
import schemaVersion2 from './jsonSchema_v2';
|
||||
import { IChoiceService, IConfirmationService } from 'vs/platform/dialogs/common/dialogs';
|
||||
schema.definitions = {
|
||||
...schemaVersion1.definitions,
|
||||
...schemaVersion2.definitions,
|
||||
|
||||
@@ -9,12 +9,12 @@ import * as platform from 'vs/base/common/platform';
|
||||
import { EDITOR_FONT_DEFAULTS, IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { ITerminalConfiguration, ITerminalConfigHelper, ITerminalFont, IShellLaunchConfig, IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, TERMINAL_CONFIG_SECTION } from 'vs/workbench/parts/terminal/common/terminal';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { isFedora } from 'vs/workbench/parts/terminal/electron-browser/terminal';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
const DEFAULT_LINE_HEIGHT = 1.0;
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ import { ITerminalInstance, ITerminalService, IShellLaunchConfig, ITerminalConfi
|
||||
import { TerminalService as AbstractTerminalService } from 'vs/workbench/parts/terminal/common/terminalService';
|
||||
import { TerminalConfigHelper } from 'vs/workbench/parts/terminal/electron-browser/terminalConfigHelper';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IChoiceService, IMessageService } from 'vs/platform/message/common/message';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { getTerminalDefaultShellWindows } from 'vs/workbench/parts/terminal/electron-browser/terminal';
|
||||
import { TerminalPanel } from 'vs/workbench/parts/terminal/electron-browser/terminalPanel';
|
||||
import { TerminalTab } from 'vs/workbench/parts/terminal/electron-browser/terminalTab';
|
||||
import { IChoiceService, IConfirmationService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
export class TerminalService extends AbstractTerminalService implements ITerminalService {
|
||||
private _configHelper: TerminalConfigHelper;
|
||||
@@ -43,7 +43,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
|
||||
@IQuickOpenService private readonly _quickOpenService: IQuickOpenService,
|
||||
@IChoiceService private readonly _choiceService: IChoiceService,
|
||||
@IStorageService private readonly _storageService: IStorageService,
|
||||
@IMessageService private readonly _messageService: IMessageService
|
||||
@IConfirmationService private readonly _confirmationService: IConfirmationService
|
||||
) {
|
||||
super(_contextKeyService, _panelService, _partService, _lifecycleService);
|
||||
|
||||
@@ -227,7 +227,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
|
||||
message = nls.localize('terminalService.terminalCloseConfirmationPlural', "There are {0} active terminal sessions, do you want to kill them?", this.terminalInstances.length);
|
||||
}
|
||||
|
||||
return this._messageService.confirm({
|
||||
return this._confirmationService.confirm({
|
||||
message,
|
||||
type: 'warning',
|
||||
}).then(confirmed => !confirmed);
|
||||
|
||||
@@ -27,10 +27,11 @@ import { FOLDER_SETTINGS_PATH, WORKSPACE_STANDALONE_CONFIGURATIONS, TASKS_CONFIG
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/resolverService';
|
||||
import { OVERRIDE_PROPERTY_PATTERN, IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { IChoiceService, IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
export enum ConfigurationEditingErrorCode {
|
||||
|
||||
|
||||
+1
-1
@@ -31,10 +31,10 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { TextModelResolverService } from 'vs/workbench/services/textmodelResolver/common/textModelResolverService';
|
||||
import { IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
|
||||
import { mkdirp } from 'vs/base/node/pfs';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
class SettingsTestEnvironmentService extends EnvironmentService {
|
||||
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import nls = require('vs/nls');
|
||||
import product from 'vs/platform/node/product';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Severity } from 'vs/platform/message/common/message';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { mnemonicButtonLabel } from 'vs/base/common/labels';
|
||||
import { IConfirmationService, IChoiceService, IConfirmation, IConfirmationResult } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { INotificationService, INotificationHandle } from 'vs/platform/notification/common/notification';
|
||||
import { once } from 'vs/base/common/event';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { basename } from 'vs/base/common/paths';
|
||||
|
||||
export class DialogService implements IChoiceService, IConfirmationService {
|
||||
|
||||
public _serviceBrand: any;
|
||||
|
||||
constructor(
|
||||
@IWindowService private windowService: IWindowService,
|
||||
@INotificationService private notificationService: INotificationService
|
||||
) {
|
||||
}
|
||||
|
||||
public confirmWithCheckbox(confirmation: IConfirmation): TPromise<IConfirmationResult> {
|
||||
const opts = this.massageMessageBoxOptions(this.getConfirmOptions(confirmation));
|
||||
|
||||
return this.windowService.showMessageBox(opts).then(result => {
|
||||
const button = isLinux ? opts.buttons.length - result.button - 1 : result.button;
|
||||
|
||||
return {
|
||||
confirmed: button === 0 ? true : false,
|
||||
checkboxChecked: result.checkboxChecked
|
||||
} as IConfirmationResult;
|
||||
});
|
||||
}
|
||||
|
||||
public confirm(confirmation: IConfirmation): TPromise<boolean> {
|
||||
const opts = this.getConfirmOptions(confirmation);
|
||||
|
||||
return this.doShowMessageBox(opts).then(result => result === 0 ? true : false);
|
||||
}
|
||||
|
||||
private getConfirmOptions(confirmation: IConfirmation): Electron.MessageBoxOptions {
|
||||
const buttons: string[] = [];
|
||||
if (confirmation.primaryButton) {
|
||||
buttons.push(confirmation.primaryButton);
|
||||
} else {
|
||||
buttons.push(nls.localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes"));
|
||||
}
|
||||
|
||||
if (confirmation.secondaryButton) {
|
||||
buttons.push(confirmation.secondaryButton);
|
||||
} else if (typeof confirmation.secondaryButton === 'undefined') {
|
||||
buttons.push(nls.localize('cancelButton', "Cancel"));
|
||||
}
|
||||
|
||||
const opts: Electron.MessageBoxOptions = {
|
||||
title: confirmation.title,
|
||||
message: confirmation.message,
|
||||
buttons,
|
||||
defaultId: 0,
|
||||
cancelId: 1
|
||||
};
|
||||
|
||||
if (confirmation.detail) {
|
||||
opts.detail = confirmation.detail;
|
||||
}
|
||||
|
||||
if (confirmation.type) {
|
||||
opts.type = confirmation.type;
|
||||
}
|
||||
|
||||
if (confirmation.checkbox) {
|
||||
opts.checkboxLabel = confirmation.checkbox.label;
|
||||
opts.checkboxChecked = confirmation.checkbox.checked;
|
||||
}
|
||||
|
||||
return opts;
|
||||
}
|
||||
|
||||
public choose(severity: Severity, message: string, options: string[], cancelId: number, modal: boolean = false): TPromise<number> {
|
||||
if (modal) {
|
||||
return this.doChooseWithDialog(severity, message, options, cancelId);
|
||||
}
|
||||
|
||||
return this.doChooseWithNotification(severity, message, options);
|
||||
}
|
||||
|
||||
private doChooseWithDialog(severity: Severity, message: string, options: string[], cancelId: number): TPromise<number> {
|
||||
const type: 'none' | 'info' | 'error' | 'question' | 'warning' = severity === Severity.Info ? 'question' : severity === Severity.Error ? 'error' : severity === Severity.Warning ? 'warning' : 'none';
|
||||
|
||||
return this.doShowMessageBox({ message, buttons: options, type, cancelId });
|
||||
}
|
||||
|
||||
private doChooseWithNotification(severity: Severity, message: string, options: string[]): TPromise<number> {
|
||||
let handle: INotificationHandle;
|
||||
|
||||
const promise = new TPromise<number>((c, e) => {
|
||||
|
||||
// Complete promise with index of action that was picked
|
||||
const callback = (index: number) => () => {
|
||||
c(index);
|
||||
|
||||
return TPromise.as(void 0);
|
||||
};
|
||||
|
||||
// Show notification with actions
|
||||
handle = this.notificationService.notify({
|
||||
severity,
|
||||
message,
|
||||
actions: { primary: options.map((option, index) => new Action('?', option, '', true, callback(index))) }
|
||||
});
|
||||
|
||||
// Cancel promise when notification gets disposed
|
||||
once(handle.onDidHide)(() => promise.cancel());
|
||||
|
||||
}, () => handle.dispose());
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
private doShowMessageBox(opts: Electron.MessageBoxOptions): TPromise<number> {
|
||||
opts = this.massageMessageBoxOptions(opts);
|
||||
|
||||
return this.windowService.showMessageBox(opts).then(result => isLinux ? opts.buttons.length - result.button - 1 : result.button);
|
||||
}
|
||||
|
||||
private massageMessageBoxOptions(opts: Electron.MessageBoxOptions): Electron.MessageBoxOptions {
|
||||
opts.buttons = opts.buttons.map(button => mnemonicButtonLabel(button));
|
||||
opts.buttons = isLinux ? opts.buttons.reverse() : opts.buttons;
|
||||
|
||||
if (opts.defaultId !== void 0) {
|
||||
opts.defaultId = isLinux ? opts.buttons.length - opts.defaultId - 1 : opts.defaultId;
|
||||
} else if (isLinux) {
|
||||
opts.defaultId = opts.buttons.length - 1; // since we reversed the buttons
|
||||
}
|
||||
|
||||
if (opts.cancelId !== void 0) {
|
||||
opts.cancelId = isLinux ? opts.buttons.length - opts.cancelId - 1 : opts.cancelId;
|
||||
}
|
||||
|
||||
opts.noLink = true;
|
||||
opts.title = opts.title || product.nameLong;
|
||||
|
||||
return opts;
|
||||
}
|
||||
}
|
||||
|
||||
const MAX_CONFIRM_FILES = 10;
|
||||
export function getConfirmMessage(start: string, resourcesToConfirm: URI[]): string {
|
||||
const message = [start];
|
||||
message.push('');
|
||||
message.push(...resourcesToConfirm.slice(0, MAX_CONFIRM_FILES).map(r => basename(r.fsPath)));
|
||||
|
||||
if (resourcesToConfirm.length > MAX_CONFIRM_FILES) {
|
||||
if (resourcesToConfirm.length - MAX_CONFIRM_FILES === 1) {
|
||||
message.push(nls.localize('moreFile', "...1 additional file not shown"));
|
||||
} else {
|
||||
message.push(nls.localize('moreFiles', "...{0} additional files not shown", resourcesToConfirm.length - MAX_CONFIRM_FILES));
|
||||
}
|
||||
}
|
||||
|
||||
message.push('');
|
||||
return message.join('\n');
|
||||
}
|
||||
@@ -9,10 +9,9 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import types = require('vs/base/common/types');
|
||||
import { MessageList, Severity as BaseSeverity } from 'vs/workbench/services/message/browser/messageList';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IMessageService, IMessageWithAction, IConfirmation, Severity, IConfirmationResult } from 'vs/platform/message/common/message';
|
||||
import { IMessageService, IMessageWithAction, Severity } from 'vs/platform/message/common/message';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import Event from 'vs/base/common/event';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
interface IBufferedMessage {
|
||||
severity: Severity;
|
||||
@@ -136,24 +135,6 @@ export class WorkbenchMessageService implements IMessageService {
|
||||
}
|
||||
}
|
||||
|
||||
public confirm(confirmation: IConfirmation): TPromise<boolean> {
|
||||
let messageText = confirmation.message;
|
||||
if (confirmation.detail) {
|
||||
messageText = messageText + '\n\n' + confirmation.detail;
|
||||
}
|
||||
|
||||
return TPromise.wrap(window.confirm(messageText));
|
||||
}
|
||||
|
||||
public confirmWithCheckbox(confirmation: IConfirmation): TPromise<IConfirmationResult> {
|
||||
return this.confirm(confirmation).then(confirmed => {
|
||||
return {
|
||||
confirmed,
|
||||
checkboxChecked: false // unsupported
|
||||
} as IConfirmationResult;
|
||||
});
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.toDispose = dispose(this.toDispose);
|
||||
}
|
||||
|
||||
@@ -5,139 +5,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import nls = require('vs/nls');
|
||||
import product from 'vs/platform/node/product';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { WorkbenchMessageService } from 'vs/workbench/services/message/browser/messageService';
|
||||
import { IConfirmation, Severity, IChoiceService, IConfirmationResult } from 'vs/platform/message/common/message';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { mnemonicButtonLabel } from 'vs/base/common/labels';
|
||||
|
||||
export class MessageService extends WorkbenchMessageService implements IChoiceService {
|
||||
export class MessageService extends WorkbenchMessageService {
|
||||
|
||||
constructor(
|
||||
container: HTMLElement,
|
||||
@IWindowService private windowService: IWindowService,
|
||||
@ITelemetryService telemetryService: ITelemetryService
|
||||
) {
|
||||
super(container, telemetryService);
|
||||
}
|
||||
|
||||
public confirmWithCheckbox(confirmation: IConfirmation): TPromise<IConfirmationResult> {
|
||||
const opts = this.massageMessageBoxOptions(this.getConfirmOptions(confirmation));
|
||||
|
||||
return this.windowService.showMessageBox(opts).then(result => {
|
||||
const button = isLinux ? opts.buttons.length - result.button - 1 : result.button;
|
||||
|
||||
return {
|
||||
confirmed: button === 0 ? true : false,
|
||||
checkboxChecked: result.checkboxChecked
|
||||
} as IConfirmationResult;
|
||||
});
|
||||
}
|
||||
|
||||
public confirm(confirmation: IConfirmation): TPromise<boolean> {
|
||||
const opts = this.getConfirmOptions(confirmation);
|
||||
|
||||
return this.doShowMessageBox(opts).then(result => result === 0 ? true : false);
|
||||
}
|
||||
|
||||
private getConfirmOptions(confirmation: IConfirmation): Electron.MessageBoxOptions {
|
||||
const buttons: string[] = [];
|
||||
if (confirmation.primaryButton) {
|
||||
buttons.push(confirmation.primaryButton);
|
||||
} else {
|
||||
buttons.push(nls.localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes"));
|
||||
}
|
||||
|
||||
if (confirmation.secondaryButton) {
|
||||
buttons.push(confirmation.secondaryButton);
|
||||
} else if (typeof confirmation.secondaryButton === 'undefined') {
|
||||
buttons.push(nls.localize('cancelButton', "Cancel"));
|
||||
}
|
||||
|
||||
let opts: Electron.MessageBoxOptions = {
|
||||
title: confirmation.title,
|
||||
message: confirmation.message,
|
||||
buttons,
|
||||
defaultId: 0,
|
||||
cancelId: 1
|
||||
};
|
||||
|
||||
if (confirmation.detail) {
|
||||
opts.detail = confirmation.detail;
|
||||
}
|
||||
|
||||
if (confirmation.type) {
|
||||
opts.type = confirmation.type;
|
||||
}
|
||||
|
||||
if (confirmation.checkbox) {
|
||||
opts.checkboxLabel = confirmation.checkbox.label;
|
||||
opts.checkboxChecked = confirmation.checkbox.checked;
|
||||
}
|
||||
|
||||
return opts;
|
||||
}
|
||||
|
||||
public choose(severity: Severity, message: string, options: string[], cancelId: number, modal: boolean = false): TPromise<number> {
|
||||
if (modal) {
|
||||
return this.doChooseModal(severity, message, options, cancelId);
|
||||
}
|
||||
|
||||
return this.doChooseWithMessage(severity, message, options);
|
||||
}
|
||||
|
||||
private doChooseModal(severity: Severity, message: string, options: string[], cancelId: number): TPromise<number> {
|
||||
const type: 'none' | 'info' | 'error' | 'question' | 'warning' = severity === Severity.Info ? 'question' : severity === Severity.Error ? 'error' : severity === Severity.Warning ? 'warning' : 'none';
|
||||
|
||||
return this.doShowMessageBox({ message, buttons: options, type, cancelId });
|
||||
}
|
||||
|
||||
private doChooseWithMessage(severity: Severity, message: string, options: string[]): TPromise<number> {
|
||||
let onCancel: () => void = null;
|
||||
|
||||
const promise = new TPromise<number>((c, e) => {
|
||||
const callback = (index: number) => () => {
|
||||
c(index);
|
||||
|
||||
return TPromise.as(true);
|
||||
};
|
||||
|
||||
const actions = options.map((option, index) => new Action('?', option, '', true, callback(index)));
|
||||
|
||||
onCancel = this.show(severity, { message, actions }, () => promise.cancel());
|
||||
}, () => onCancel());
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
private doShowMessageBox(opts: Electron.MessageBoxOptions): TPromise<number> {
|
||||
opts = this.massageMessageBoxOptions(opts);
|
||||
|
||||
return this.windowService.showMessageBox(opts).then(result => isLinux ? opts.buttons.length - result.button - 1 : result.button);
|
||||
}
|
||||
|
||||
private massageMessageBoxOptions(opts: Electron.MessageBoxOptions): Electron.MessageBoxOptions {
|
||||
opts.buttons = opts.buttons.map(button => mnemonicButtonLabel(button));
|
||||
opts.buttons = isLinux ? opts.buttons.reverse() : opts.buttons;
|
||||
|
||||
if (opts.defaultId !== void 0) {
|
||||
opts.defaultId = isLinux ? opts.buttons.length - opts.defaultId - 1 : opts.defaultId;
|
||||
} else if (isLinux) {
|
||||
opts.defaultId = opts.buttons.length - 1; // since we reversed the buttons
|
||||
}
|
||||
|
||||
if (opts.cancelId !== void 0) {
|
||||
opts.cancelId = isLinux ? opts.buttons.length - opts.cancelId - 1 : opts.cancelId;
|
||||
}
|
||||
|
||||
opts.noLink = true;
|
||||
opts.title = opts.title || product.nameLong;
|
||||
|
||||
return opts;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,13 +24,14 @@ import { createTextBufferFactoryFromStream } from 'vs/editor/common/model/textMo
|
||||
import product from 'vs/platform/node/product';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService, getConfirmMessage } from 'vs/platform/message/common/message';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
||||
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IHistoryService } from 'vs/workbench/services/history/common/history';
|
||||
import { mnemonicButtonLabel } from 'vs/base/common/labels';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { getConfirmMessage } from 'vs/workbench/services/dialogs/electron-browser/dialogs';
|
||||
|
||||
export class TextFileService extends AbstractTextFileService {
|
||||
|
||||
|
||||
@@ -23,11 +23,12 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
|
||||
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
||||
import { BackupFileService } from 'vs/workbench/services/backup/node/backupFileService';
|
||||
import { IChoiceService, Severity, IMessageService } from 'vs/platform/message/common/message';
|
||||
import { Severity, IMessageService } from 'vs/platform/message/common/message';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { distinct } from 'vs/base/common/arrays';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { isEqual } from 'vs/base/common/resources';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
export class WorkspaceEditingService implements IWorkspaceEditingService {
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ import * as assert from 'assert';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { MainThreadMessageService } from 'vs/workbench/api/electron-browser/mainThreadMessageService';
|
||||
import { TPromise as Promise } from 'vs/base/common/winjs.base';
|
||||
import { IMessageService, IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
const emptyChoiceService = new class implements IChoiceService {
|
||||
_serviceBrand: 'choiceService';
|
||||
|
||||
@@ -25,7 +25,7 @@ import { TextModelResolverService } from 'vs/workbench/services/textmodelResolve
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { IEditorInput, IEditorOptions, Position, IEditor, IResourceInput } from 'vs/platform/editor/common/editor';
|
||||
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IMessageService, IConfirmation, IConfirmationResult, IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IWorkspaceContextService, IWorkspace as IWorkbenchWorkspace, WorkbenchState, IWorkspaceFolder, IWorkspaceFoldersChangeEvent } from 'vs/platform/workspace/common/workspace';
|
||||
import { ILifecycleService, ShutdownEvent, ShutdownReason, StartupKind, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { EditorStacksModel } from 'vs/workbench/common/editor/editorStacksModel';
|
||||
@@ -63,6 +63,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||
import { ITextBufferFactory, DefaultEndOfLine, EndOfLinePreference } from 'vs/editor/common/model';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { IChoiceService, IConfirmation, IConfirmationResult, IConfirmationService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
|
||||
return instantiationService.createInstance(FileEditorInput, resource, void 0);
|
||||
@@ -332,6 +333,11 @@ export class TestMessageService implements IMessageService {
|
||||
public hideAll(): void {
|
||||
// No-op
|
||||
}
|
||||
}
|
||||
|
||||
export class TestConfirmationService implements IConfirmationService {
|
||||
|
||||
public _serviceBrand: any;
|
||||
|
||||
public confirm(confirmation: IConfirmation): TPromise<boolean> {
|
||||
return TPromise.wrap(false);
|
||||
|
||||
Reference in New Issue
Block a user