workbenchTestServices.ts 48.2 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

6
import 'vs/workbench/contrib/files/browser/files.contribution'; // load our contribution into the test
7
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
8
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
9
import { join } from 'vs/base/common/path';
10
import * as resources from 'vs/base/common/resources';
11
import { URI } from 'vs/base/common/uri';
12 13
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
14 15
import { ConfirmResult, IEditorInputWithOptions, CloseDirection, IEditorIdentifier, IUntitledResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInput, IEditor, IEditorCloseEvent, IEditorPartOptions } from 'vs/workbench/common/editor';
import { IEditorOpeningEvent, EditorServiceImpl, IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
M
Matt Bierner 已提交
16
import { Event, Emitter } from 'vs/base/common/event';
E
Erich Gamma 已提交
17
import Severity from 'vs/base/common/severity';
18
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
19
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
B
Benjamin Pasero 已提交
20
import { IWorkbenchLayoutService, Parts, Position as PartPosition } from 'vs/workbench/services/layout/browser/layoutService';
21
import { TextModelResolverService } from 'vs/workbench/services/textmodelResolver/common/textModelResolverService';
22
import { ITextModelService } from 'vs/editor/common/services/resolverService';
B
Benjamin Pasero 已提交
23
import { IEditorOptions, IResourceInput } from 'vs/platform/editor/common/editor';
J
Johannes Rieken 已提交
24
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
S
Sandeep Somavarapu 已提交
25
import { IWorkspaceContextService, IWorkspace as IWorkbenchWorkspace, WorkbenchState, IWorkspaceFolder, IWorkspaceFoldersChangeEvent, Workspace } from 'vs/platform/workspace/common/workspace';
26
import { ILifecycleService, BeforeShutdownEvent, ShutdownReason, StartupKind, LifecyclePhase, WillShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle';
J
Johannes Rieken 已提交
27
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
28
import { TextFileService } from 'vs/workbench/services/textfile/common/textFileService';
29
import { FileOperationEvent, IFileService, IResolveContentOptions, FileOperationError, IFileStat, IResolveFileResult, FileChangesEvent, IResolveFileOptions, IContent, IUpdateContentOptions, IStreamContent, ICreateFileOptions, ITextSnapshot, IResourceEncodings } from 'vs/platform/files/common/files';
30
import { IModelService } from 'vs/editor/common/services/modelService';
31
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
J
Johannes Rieken 已提交
32 33 34 35 36 37
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import { IRawTextContent, ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { parseArgs } from 'vs/platform/environment/node/argv';
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
38
import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
39
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
40
import { IWindowsService, IWindowService, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, IWindowConfiguration, MenuBarVisibility, IURIToOpen } from 'vs/platform/windows/common/windows';
S
Sandeep Somavarapu 已提交
41
import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
42
import { createTextBufferFactory } from 'vs/editor/common/model/textModel';
B
Benjamin Pasero 已提交
43
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
44
import { IThemeService } from 'vs/platform/theme/common/themeService';
B
Benjamin Pasero 已提交
45
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
46
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
M
Martin Aeschlimann 已提交
47
import { IRecentlyOpened, IRecent } from 'vs/platform/history/common/history';
S
Sandeep Somavarapu 已提交
48
import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
49
import { IPosition, Position as EditorPosition } from 'vs/editor/common/core/position';
B
Benjamin Pasero 已提交
50
import { IMenuService, MenuId, IMenu, ISerializableCommandAction } from 'vs/platform/actions/common/actions';
R
Ramya Achutha Rao 已提交
51
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
I
isidor 已提交
52
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
B
Benjamin Pasero 已提交
53
import { MockContextKeyService, MockKeybindingService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
B
Benjamin Pasero 已提交
54
import { ITextBufferFactory, DefaultEndOfLine, EndOfLinePreference, IModelDecorationOptions, ITextModel } from 'vs/editor/common/model';
55
import { Range } from 'vs/editor/common/core/range';
M
Martin Aeschlimann 已提交
56
import { IConfirmation, IConfirmationResult, IDialogService, IDialogOptions, IPickAndOpenOptions, ISaveDialogOptions, IOpenDialogOptions, IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
57 58
import { INotificationService } from 'vs/platform/notification/common/notification';
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
59
import { IExtensionService, NullExtensionService } from 'vs/workbench/services/extensions/common/extensions';
B
Benjamin Pasero 已提交
60
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
B
Benjamin Pasero 已提交
61
import { IDecorationsService, IResourceDecorationChangeEvent, IDecoration, IDecorationData, IDecorationsProvider } from 'vs/workbench/services/decorations/browser/decorations';
J
Joao Moreno 已提交
62
import { IDisposable, toDisposable, Disposable } from 'vs/base/common/lifecycle';
63
import { IEditorGroupsService, IEditorGroup, GroupsOrder, GroupsArrangement, GroupDirection, IAddGroupOptions, IMergeGroupOptions, IMoveEditorOptions, ICopyEditorOptions, IEditorReplacement, IGroupChangeEvent, EditorsOrder, IFindGroupScope, EditorGroupLayout, ICloseEditorOptions } from 'vs/workbench/services/editor/common/editorGroupsService';
M
Matt Bierner 已提交
64
import { IEditorService, IOpenEditorOverrideHandler, IActiveEditor } from 'vs/workbench/services/editor/common/editorService';
B
Benjamin Pasero 已提交
65 66 67
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
import { IDecorationRenderOptions } from 'vs/editor/common/editorCommon';
B
Benjamin Pasero 已提交
68
import { EditorGroup } from 'vs/workbench/common/editor/editorGroup';
69
import { Dimension } from 'vs/base/browser/dom';
70
import { ILogService, LogLevel } from 'vs/platform/log/common/log';
I
isidor 已提交
71
import { ILabelService } from 'vs/platform/label/common/label';
72
import { timeout } from 'vs/base/common/async';
73
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
74
import { ViewletDescriptor, Viewlet } from 'vs/workbench/browser/viewlet';
75
import { IViewlet } from 'vs/workbench/common/viewlet';
76
import { IStorageService, InMemoryStorageService } from 'vs/platform/storage/common/storage';
S
Sandeep Somavarapu 已提交
77
import { isLinux, isMacintosh } from 'vs/base/common/platform';
I
isidor 已提交
78
import { LabelService } from 'vs/workbench/services/label/common/labelService';
B
Benjamin Pasero 已提交
79
import { IDimension } from 'vs/platform/layout/browser/layoutService';
80
import { Part } from 'vs/workbench/browser/part';
81 82 83
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IPanel } from 'vs/workbench/common/panel';
import { IBadge } from 'vs/workbench/services/activity/common/activity';
84
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
B
Benjamin Pasero 已提交
85

S
Sandeep Somavarapu 已提交
86
export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
R
Rob Lourens 已提交
87
	return instantiationService.createInstance(FileEditorInput, resource, undefined);
S
Sandeep Somavarapu 已提交
88 89
}

90
export const TestEnvironmentService = new EnvironmentService(parseArgs(process.argv), process.execPath);
91

92
export class TestContextService implements IWorkspaceContextService {
93
	public _serviceBrand: any;
E
Erich Gamma 已提交
94

S
Sandeep Somavarapu 已提交
95
	private workspace: Workspace;
E
Erich Gamma 已提交
96 97
	private options: any;

M
Matt Bierner 已提交
98 99 100
	private readonly _onDidChangeWorkspaceName: Emitter<void>;
	private readonly _onDidChangeWorkspaceFolders: Emitter<IWorkspaceFoldersChangeEvent>;
	private readonly _onDidChangeWorkbenchState: Emitter<WorkbenchState>;
101

102
	constructor(workspace: any = TestWorkspace, options: any = null) {
E
Erich Gamma 已提交
103
		this.workspace = workspace;
104
		this.options = options || Object.create(null);
105
		this._onDidChangeWorkspaceFolders = new Emitter<IWorkspaceFoldersChangeEvent>();
S
Sandeep Somavarapu 已提交
106
		this._onDidChangeWorkbenchState = new Emitter<WorkbenchState>();
107 108
	}

S
Sandeep Somavarapu 已提交
109 110 111 112
	public get onDidChangeWorkspaceName(): Event<void> {
		return this._onDidChangeWorkspaceName.event;
	}

113
	public get onDidChangeWorkspaceFolders(): Event<IWorkspaceFoldersChangeEvent> {
S
Sandeep Somavarapu 已提交
114
		return this._onDidChangeWorkspaceFolders.event;
115 116
	}

117 118 119 120
	public get onDidChangeWorkbenchState(): Event<WorkbenchState> {
		return this._onDidChangeWorkbenchState.event;
	}

S
Sandeep Somavarapu 已提交
121
	public getFolders(): IWorkspaceFolder[] {
S
Sandeep Somavarapu 已提交
122
		return this.workspace ? this.workspace.folders : [];
E
Erich Gamma 已提交
123 124
	}

125
	public getWorkbenchState(): WorkbenchState {
B
Benjamin Pasero 已提交
126 127 128 129 130
		if (this.workspace.configuration) {
			return WorkbenchState.WORKSPACE;
		}

		if (this.workspace.folders.length) {
131
			return WorkbenchState.FOLDER;
132
		}
B
Benjamin Pasero 已提交
133

134
		return WorkbenchState.EMPTY;
S
Sandeep Somavarapu 已提交
135 136
	}

137 138 139 140
	getCompleteWorkspace(): Promise<IWorkbenchWorkspace> {
		return Promise.resolve(this.getWorkspace());
	}

141
	public getWorkspace(): IWorkbenchWorkspace {
B
Benjamin Pasero 已提交
142
		return this.workspace;
143 144
	}

145
	public getWorkspaceFolder(resource: URI): IWorkspaceFolder | null {
S
Sandeep Somavarapu 已提交
146
		return this.workspace.getFolder(resource);
147 148
	}

D
Daniel Imms 已提交
149 150 151 152
	public setWorkspace(workspace: any): void {
		this.workspace = workspace;
	}

E
Erich Gamma 已提交
153 154 155 156 157 158 159 160 161 162
	public getOptions() {
		return this.options;
	}

	public updateOptions() {

	}

	public isInsideWorkspace(resource: URI): boolean {
		if (resource && this.workspace) {
163
			return resources.isEqualOrParent(resource, this.workspace.folders[0].uri);
E
Erich Gamma 已提交
164 165 166 167 168 169
		}

		return false;
	}

	public toResource(workspaceRelativePath: string): URI {
170
		return URI.file(join('C:\\', workspaceRelativePath));
E
Erich Gamma 已提交
171
	}
172

173
	public isCurrentWorkspace(workspaceIdentifier: ISingleFolderWorkspaceIdentifier | IWorkspaceIdentifier): boolean {
174
		return isSingleFolderWorkspaceIdentifier(workspaceIdentifier) && resources.isEqual(this.workspace.folders[0].uri, workspaceIdentifier);
175
	}
E
Erich Gamma 已提交
176 177
}

178
export class TestTextFileService extends TextFileService {
179 180
	public cleanupBackupsBeforeShutdownCalled: boolean;

M
Martin Aeschlimann 已提交
181
	private promptPath: URI;
182
	private confirmResult: ConfirmResult;
183
	private resolveTextContentError: FileOperationError | null;
A
Alex Dima 已提交
184 185

	constructor(
186
		@IWorkspaceContextService contextService: IWorkspaceContextService,
187
		@IFileService protected fileService: IFileService,
188
		@IUntitledEditorService untitledEditorService: IUntitledEditorService,
189
		@ILifecycleService lifecycleService: ILifecycleService,
190
		@IInstantiationService instantiationService: IInstantiationService,
191 192 193 194 195
		@IConfigurationService configurationService: IConfigurationService,
		@IModeService modeService: IModeService,
		@IModelService modelService: IModelService,
		@IWindowService windowService: IWindowService,
		@IEnvironmentService environmentService: IEnvironmentService,
196
		@INotificationService notificationService: INotificationService,
197
		@IBackupFileService backupFileService: IBackupFileService,
198
		@IWindowsService windowsService: IWindowsService,
I
isidor 已提交
199
		@IHistoryService historyService: IHistoryService,
B
Benjamin Pasero 已提交
200
		@IContextKeyService contextKeyService: IContextKeyService,
201 202 203
		@IDialogService dialogService: IDialogService,
		@IFileDialogService fileDialogService: IFileDialogService,
		@IEditorService editorService: IEditorService
A
Alex Dima 已提交
204
	) {
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
		super(
			contextService,
			fileService,
			untitledEditorService,
			lifecycleService,
			instantiationService,
			configurationService,
			modeService,
			modelService,
			windowService,
			environmentService,
			notificationService,
			backupFileService,
			windowsService,
			historyService,
			contextKeyService,
			dialogService,
			fileDialogService,
			editorService
		);
A
Alex Dima 已提交
225
	}
226

M
Martin Aeschlimann 已提交
227
	public setPromptPath(path: URI): void {
228 229 230 231 232 233 234
		this.promptPath = path;
	}

	public setConfirmResult(result: ConfirmResult): void {
		this.confirmResult = result;
	}

235
	public setResolveTextContentErrorOnce(error: FileOperationError): void {
236 237 238
		this.resolveTextContentError = error;
	}

J
Johannes Rieken 已提交
239
	public resolveTextContent(resource: URI, options?: IResolveContentOptions): Promise<IRawTextContent> {
240 241 242 243
		if (this.resolveTextContentError) {
			const error = this.resolveTextContentError;
			this.resolveTextContentError = null;

B
Benjamin Pasero 已提交
244
			return Promise.reject(error);
245 246
		}

247 248
		return this.fileService.resolveContent(resource, options).then((content): IRawTextContent => {
			return {
249
				resource: content.resource,
250 251 252 253
				name: content.name,
				mtime: content.mtime,
				etag: content.etag,
				encoding: content.encoding,
254
				value: createTextBufferFactory(content.value)
255 256 257
			};
		});
	}
258

J
Johannes Rieken 已提交
259
	public promptForPath(_resource: URI, _defaultPath: URI): Promise<URI> {
B
Benjamin Pasero 已提交
260
		return Promise.resolve(this.promptPath);
261 262
	}

J
Johannes Rieken 已提交
263
	public confirmSave(_resources?: URI[]): Promise<ConfirmResult> {
B
Benjamin Pasero 已提交
264
		return Promise.resolve(this.confirmResult);
265
	}
D
Daniel Imms 已提交
266

B
Benjamin Pasero 已提交
267 268 269 270
	public confirmOverwrite(_resource: URI): Promise<boolean> {
		return Promise.resolve(true);
	}

271 272
	public onFilesConfigurationChange(configuration: any): void {
		super.onFilesConfigurationChange(configuration);
273 274
	}

J
Johannes Rieken 已提交
275
	protected cleanupBackupsBeforeShutdown(): Promise<void> {
276
		this.cleanupBackupsBeforeShutdownCalled = true;
B
Benjamin Pasero 已提交
277
		return Promise.resolve();
278
	}
A
Alex Dima 已提交
279 280
}

281
export function workbenchInstantiationService(): IInstantiationService {
282
	let instantiationService = new TestInstantiationService(new ServiceCollection([ILifecycleService, new TestLifecycleService()]));
283
	instantiationService.stub(IEnvironmentService, TestEnvironmentService);
I
isidor 已提交
284
	instantiationService.stub(IContextKeyService, <IContextKeyService>instantiationService.createInstance(MockContextKeyService));
I
isidor 已提交
285 286
	const workspaceContextService = new TestContextService(TestWorkspace);
	instantiationService.stub(IWorkspaceContextService, workspaceContextService);
287 288 289
	const configService = new TestConfigurationService();
	instantiationService.stub(IConfigurationService, configService);
	instantiationService.stub(ITextResourceConfigurationService, new TestTextResourceConfigurationService(configService));
290
	instantiationService.stub(IUntitledEditorService, instantiationService.createInstance(UntitledEditorService));
291
	instantiationService.stub(IStorageService, new TestStorageService());
292
	instantiationService.stub(IWorkbenchLayoutService, new TestLayoutService());
J
Johannes Rieken 已提交
293
	instantiationService.stub(IModeService, instantiationService.createInstance(ModeServiceImpl));
B
Benjamin Pasero 已提交
294
	instantiationService.stub(IHistoryService, new TestHistoryService());
S
Sandeep Somavarapu 已提交
295
	instantiationService.stub(ITextResourcePropertiesService, new TestTextResourcePropertiesService(configService));
S
Sandeep Somavarapu 已提交
296
	instantiationService.stub(IModelService, instantiationService.createInstance(ModelServiceImpl));
297
	instantiationService.stub(IFileService, new TestFileService());
298
	instantiationService.stub(IBackupFileService, new TestBackupFileService());
299
	instantiationService.stub(ITelemetryService, NullTelemetryService);
300
	instantiationService.stub(INotificationService, new TestNotificationService());
B
Benjamin Pasero 已提交
301
	instantiationService.stub(IUntitledEditorService, instantiationService.createInstance(UntitledEditorService));
302
	instantiationService.stub(IWindowService, new TestWindowService());
B
Benjamin Pasero 已提交
303 304 305 306
	instantiationService.stub(IMenuService, new TestMenuService());
	instantiationService.stub(IKeybindingService, new MockKeybindingService());
	instantiationService.stub(IDecorationsService, new TestDecorationsService());
	instantiationService.stub(IExtensionService, new TestExtensionService());
307
	instantiationService.stub(IWindowsService, new TestWindowsService());
308
	instantiationService.stub(ITextFileService, <ITextFileService>instantiationService.createInstance(TestTextFileService));
309
	instantiationService.stub(ITextModelService, <ITextModelService>instantiationService.createInstance(TextModelResolverService));
B
Benjamin Pasero 已提交
310
	instantiationService.stub(IThemeService, new TestThemeService());
R
Ramya Achutha Rao 已提交
311
	instantiationService.stub(IHashService, new TestHashService());
I
isidor 已提交
312
	instantiationService.stub(ILogService, new TestLogService());
313
	instantiationService.stub(IEditorGroupsService, new TestEditorGroupsService([new TestEditorGroup(0)]));
M
Martin Aeschlimann 已提交
314
	instantiationService.stub(ILabelService, <ILabelService>instantiationService.createInstance(LabelService));
B
Benjamin Pasero 已提交
315
	const editorService = new TestEditorService();
316
	instantiationService.stub(IEditorService, editorService);
B
Benjamin Pasero 已提交
317
	instantiationService.stub(ICodeEditorService, new TestCodeEditorService());
318
	instantiationService.stub(IViewletService, new TestViewletService());
319 320 321 322

	return instantiationService;
}

I
isidor 已提交
323 324 325
export class TestLogService implements ILogService {
	_serviceBrand: any; onDidChangeLogLevel: Event<LogLevel>;
	getLevel(): LogLevel { return LogLevel.Info; }
326 327 328 329 330 331 332
	setLevel(_level: LogLevel): void { }
	trace(_message: string, ..._args: any[]): void { }
	debug(_message: string, ..._args: any[]): void { }
	info(_message: string, ..._args: any[]): void { }
	warn(_message: string, ..._args: any[]): void { }
	error(_message: string | Error, ..._args: any[]): void { }
	critical(_message: string | Error, ..._args: any[]): void { }
I
isidor 已提交
333 334 335
	dispose(): void { }
}

B
Benjamin Pasero 已提交
336 337 338
export class TestDecorationsService implements IDecorationsService {
	_serviceBrand: any;
	onDidChangeDecorations: Event<IResourceDecorationChangeEvent> = Event.None;
339
	registerDecorationsProvider(_provider: IDecorationsProvider): IDisposable { return Disposable.None; }
340
	getDecoration(_uri: URI, _includeChildren: boolean, _overwrite?: IDecorationData): IDecoration | undefined { return undefined; }
B
Benjamin Pasero 已提交
341 342
}

343
export class TestExtensionService extends NullExtensionService { }
B
Benjamin Pasero 已提交
344 345 346 347 348

export class TestMenuService implements IMenuService {

	public _serviceBrand: any;

349
	createMenu(_id: MenuId, _scopedKeybindingService: IContextKeyService): IMenu {
B
Benjamin Pasero 已提交
350 351
		return {
			onDidChange: Event.None,
R
Rob Lourens 已提交
352
			dispose: () => undefined,
B
Benjamin Pasero 已提交
353 354 355 356 357
			getActions: () => []
		};
	}
}

B
Benjamin Pasero 已提交
358 359 360 361 362 363 364 365 366 367
export class TestHistoryService implements IHistoryService {

	public _serviceBrand: any;

	constructor(private root?: URI) {
	}

	public reopenLastClosedEditor(): void {
	}

368
	public forward(_acrossEditors?: boolean): void {
B
Benjamin Pasero 已提交
369 370
	}

371
	public back(_acrossEditors?: boolean): void {
B
Benjamin Pasero 已提交
372 373
	}

374 375 376
	public last(): void {
	}

377
	public remove(_input: IEditorInput | IResourceInput): void {
B
Benjamin Pasero 已提交
378 379 380 381 382
	}

	public clear(): void {
	}

B
Benjamin Pasero 已提交
383 384 385
	public clearRecentlyOpened(): void {
	}

386
	public getHistory(): Array<IEditorInput | IResourceInput> {
B
Benjamin Pasero 已提交
387 388 389
		return [];
	}

390
	public getLastActiveWorkspaceRoot(_schemeFilter: string): URI | undefined {
B
Benjamin Pasero 已提交
391 392
		return this.root;
	}
393

394
	public getLastActiveFile(_schemeFilter: string): URI | undefined {
R
Rob Lourens 已提交
395
		return undefined;
396
	}
B
Benjamin Pasero 已提交
397 398 399

	public openLastEditLocation(): void {
	}
B
Benjamin Pasero 已提交
400 401
}

402
export class TestDialogService implements IDialogService {
403 404

	public _serviceBrand: any;
E
Erich Gamma 已提交
405

J
Johannes Rieken 已提交
406
	public confirm(_confirmation: IConfirmation): Promise<IConfirmationResult> {
B
Benjamin Pasero 已提交
407
		return Promise.resolve({ confirmed: false });
408
	}
409

J
Johannes Rieken 已提交
410
	public show(_severity: Severity, _message: string, _buttons: string[], _options?: IDialogOptions): Promise<number> {
B
Benjamin Pasero 已提交
411
		return Promise.resolve(0);
412
	}
E
Erich Gamma 已提交
413 414
}

M
Martin Aeschlimann 已提交
415 416 417 418
export class TestFileDialogService implements IFileDialogService {

	public _serviceBrand: any;

419
	public defaultFilePath(_schemeFilter?: string): URI | undefined {
R
Rob Lourens 已提交
420
		return undefined;
M
Martin Aeschlimann 已提交
421
	}
422
	public defaultFolderPath(_schemeFilter?: string): URI | undefined {
R
Rob Lourens 已提交
423
		return undefined;
M
Martin Aeschlimann 已提交
424
	}
425
	public defaultWorkspacePath(_schemeFilter?: string): URI | undefined {
R
Rob Lourens 已提交
426
		return undefined;
M
Martin Aeschlimann 已提交
427
	}
J
Johannes Rieken 已提交
428
	public pickFileFolderAndOpen(_options: IPickAndOpenOptions): Promise<any> {
B
Benjamin Pasero 已提交
429
		return Promise.resolve(0);
M
Martin Aeschlimann 已提交
430
	}
J
Johannes Rieken 已提交
431
	public pickFileAndOpen(_options: IPickAndOpenOptions): Promise<any> {
B
Benjamin Pasero 已提交
432
		return Promise.resolve(0);
M
Martin Aeschlimann 已提交
433
	}
J
Johannes Rieken 已提交
434
	public pickFolderAndOpen(_options: IPickAndOpenOptions): Promise<any> {
B
Benjamin Pasero 已提交
435
		return Promise.resolve(0);
M
Martin Aeschlimann 已提交
436
	}
J
Johannes Rieken 已提交
437
	public pickWorkspaceAndOpen(_options: IPickAndOpenOptions): Promise<any> {
B
Benjamin Pasero 已提交
438
		return Promise.resolve(0);
M
Martin Aeschlimann 已提交
439
	}
440
	public showSaveDialog(_options: ISaveDialogOptions): Promise<URI | undefined> {
J
Johannes Rieken 已提交
441
		return Promise.resolve(undefined);
M
Martin Aeschlimann 已提交
442
	}
443
	public showOpenDialog(_options: IOpenDialogOptions): Promise<URI[] | undefined> {
J
Johannes Rieken 已提交
444
		return Promise.resolve(undefined);
M
Martin Aeschlimann 已提交
445 446 447
	}
}

448
export class TestLayoutService implements IWorkbenchLayoutService {
B
Benjamin Pasero 已提交
449

450
	public _serviceBrand: any;
E
Erich Gamma 已提交
451

452 453
	dimension: IDimension = { width: 800, height: 600 };

454 455
	container: HTMLElement = window.document.body;

B
Benjamin Pasero 已提交
456
	onZenModeChange: Event<boolean> = Event.None;
457
	onLayout = Event.None;
B
Benjamin Pasero 已提交
458

459
	private _onTitleBarVisibilityChange = new Emitter<void>();
460
	private _onMenubarVisibilityChange = new Emitter<Dimension>();
461 462 463 464 465

	public get onTitleBarVisibilityChange(): Event<void> {
		return this._onTitleBarVisibilityChange.event;
	}

466 467 468 469
	public get onMenubarVisibilityChange(): Event<Dimension> {
		return this._onMenubarVisibilityChange.event;
	}

B
Benjamin Pasero 已提交
470
	public isRestored(): boolean {
E
Erich Gamma 已提交
471 472 473
		return true;
	}

474
	public hasFocus(_part: Parts): boolean {
E
Erich Gamma 已提交
475 476 477
		return false;
	}

478
	public isVisible(_part: Parts): boolean {
E
Erich Gamma 已提交
479 480 481
		return true;
	}

482
	public getContainer(_part: Parts): HTMLElement | null {
483 484 485
		return null;
	}

B
Benjamin Pasero 已提交
486 487 488 489
	public isTitleBarHidden(): boolean {
		return false;
	}

490 491 492 493
	public getTitleBarOffset(): number {
		return 0;
	}

494 495 496 497
	public isStatusBarHidden(): boolean {
		return false;
	}

S
Sanders Lauture 已提交
498 499 500 501
	public isActivityBarHidden(): boolean {
		return false;
	}

502
	public setActivityBarHidden(_hidden: boolean): void { }
S
Sanders Lauture 已提交
503

E
Erich Gamma 已提交
504 505 506 507
	public isSideBarHidden(): boolean {
		return false;
	}

508
	public setEditorHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
S
SteVen Batten 已提交
509

510
	public setSideBarHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
E
Erich Gamma 已提交
511

I
isidor 已提交
512
	public isPanelHidden(): boolean {
I
isidor 已提交
513 514 515
		return false;
	}

516
	public setPanelHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
I
isidor 已提交
517

I
isidor 已提交
518 519
	public toggleMaximizedPanel(): void { }

B
Benjamin Pasero 已提交
520 521 522 523
	public isPanelMaximized(): boolean {
		return false;
	}

S
SteVen Batten 已提交
524
	public getMenubarVisibility(): MenuBarVisibility {
525
		throw new Error('not implemented');
S
SteVen Batten 已提交
526 527
	}

E
Erich Gamma 已提交
528 529 530 531
	public getSideBarPosition() {
		return 0;
	}

I
isidor 已提交
532 533 534 535
	public getPanelPosition() {
		return 0;
	}

J
Johannes Rieken 已提交
536
	public setPanelPosition(_position: PartPosition): Promise<void> {
537
		return Promise.resolve();
I
isidor 已提交
538 539
	}

540 541
	public addClass(_clazz: string): void { }
	public removeClass(_clazz: string): void { }
542
	public getWorkbenchElement(): HTMLElement { throw new Error('not implemented'); }
B
Benjamin Pasero 已提交
543

I
isidor 已提交
544
	public toggleZenMode(): void { }
545

B
Benjamin Pasero 已提交
546
	public isEditorLayoutCentered(): boolean { return false; }
547
	public centerEditorLayout(_active: boolean): void { }
S
SrTobi 已提交
548 549


550
	public resizePart(_part: Parts, _sizeChange: number): void { }
551 552

	public registerPart(part: Part): void { }
E
Erich Gamma 已提交
553 554
}

555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
let activeViewlet: Viewlet = {} as any;

export class TestViewletService implements IViewletService {
	public _serviceBrand: any;

	onDidViewletRegisterEmitter = new Emitter<ViewletDescriptor>();
	onDidViewletDeregisterEmitter = new Emitter<ViewletDescriptor>();
	onDidViewletOpenEmitter = new Emitter<IViewlet>();
	onDidViewletCloseEmitter = new Emitter<IViewlet>();

	onDidViewletRegister = this.onDidViewletRegisterEmitter.event;
	onDidViewletDeregister = this.onDidViewletDeregisterEmitter.event;
	onDidViewletOpen = this.onDidViewletOpenEmitter.event;
	onDidViewletClose = this.onDidViewletCloseEmitter.event;

	public openViewlet(id: string, focus?: boolean): Promise<IViewlet> {
		return Promise.resolve(null!);
	}

	public getViewlets(): ViewletDescriptor[] {
		return [];
	}

	public getAllViewlets(): ViewletDescriptor[] {
		return [];
	}

	public getActiveViewlet(): IViewlet {
		return activeViewlet;
	}

	public dispose() {
	}

	public getDefaultViewletId(): string {
		return 'workbench.view.explorer';
	}

	public getViewlet(id: string): ViewletDescriptor | undefined {
		return undefined;
	}

	public getProgressIndicator(id: string) {
		return null!;
	}
600 601 602 603 604 605

	public hideActiveViewlet(): void { }

	public getLastActiveViewletId(): string {
		return undefined;
	}
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643
}

export class TestPanelService implements IPanelService {
	public _serviceBrand: any;

	onDidPanelOpen = new Emitter<{ panel: IPanel, focus: boolean }>().event;
	onDidPanelClose = new Emitter<IPanel>().event;

	public openPanel(id: string, focus?: boolean): IPanel {
		return null!;
	}

	public getPanels(): any[] {
		return [];
	}

	public getPinnedPanels(): any[] {
		return [];
	}

	public getActivePanel(): IViewlet {
		return activeViewlet;
	}

	public setPanelEnablement(id: string, enabled: boolean): void { }

	public dispose() {
	}

	public showActivity(panelId: string, badge: IBadge, clazz?: string): IDisposable {
		throw new Error('Method not implemented.');
	}

	public hideActivePanel(): void { }

	public getLastActivePanelId(): string {
		return undefined;
	}
E
Erich Gamma 已提交
644 645
}

646
export class TestStorageService extends InMemoryStorageService { }
647

648 649
export class TestEditorGroupsService implements IEditorGroupsService {

650 651
	_serviceBrand: ServiceIdentifier<any>;

B
Benjamin Pasero 已提交
652
	constructor(public groups: TestEditorGroup[] = []) { }
653

654
	onDidActiveGroupChange: Event<IEditorGroup> = Event.None;
B
Benjamin Pasero 已提交
655
	onDidActivateGroup: Event<IEditorGroup> = Event.None;
656 657 658
	onDidAddGroup: Event<IEditorGroup> = Event.None;
	onDidRemoveGroup: Event<IEditorGroup> = Event.None;
	onDidMoveGroup: Event<IEditorGroup> = Event.None;
659
	onDidLayout: Event<IDimension> = Event.None;
660 661

	orientation: any;
R
Rob Lourens 已提交
662
	whenRestored: Promise<void> = Promise.resolve(undefined);
663

664
	get activeGroup(): IEditorGroup {
665 666 667 668 669 670 671
		return this.groups[0];
	}

	get count(): number {
		return this.groups.length;
	}

672
	getGroups(_order?: GroupsOrder): ReadonlyArray<IEditorGroup> {
673 674 675
		return this.groups;
	}

676
	getGroup(identifier: number): IEditorGroup {
677 678 679
		for (const group of this.groups) {
			if (group.id === identifier) {
				return group;
680 681 682
			}
		}

683
		return undefined!;
684 685
	}

686
	getLabel(_identifier: number): string {
687 688 689
		return 'Group 1';
	}

690
	findGroup(_scope: IFindGroupScope, _source?: number | IEditorGroup, _wrap?: boolean): IEditorGroup {
691
		throw new Error('not implemented');
692 693
	}

694
	activateGroup(_group: number | IEditorGroup): IEditorGroup {
695
		throw new Error('not implemented');
696 697
	}

698
	getSize(_group: number | IEditorGroup): number {
699
		return 100;
700 701
	}

702
	setSize(_group: number | IEditorGroup, _size: number): void { }
703

704
	arrangeGroups(_arrangement: GroupsArrangement): void { }
705

706
	applyLayout(_layout: EditorGroupLayout): void { }
707

708
	setGroupOrientation(_orientation: any): void { }
709

710
	addGroup(_location: number | IEditorGroup, _direction: GroupDirection, _options?: IAddGroupOptions): IEditorGroup {
711
		throw new Error('not implemented');
712 713
	}

714
	removeGroup(_group: number | IEditorGroup): void { }
715

716
	moveGroup(_group: number | IEditorGroup, _location: number | IEditorGroup, _direction: GroupDirection): IEditorGroup {
717
		throw new Error('not implemented');
718 719
	}

720
	mergeGroup(_group: number | IEditorGroup, _target: number | IEditorGroup, _options?: IMergeGroupOptions): IEditorGroup {
721
		throw new Error('not implemented');
722 723
	}

724
	copyGroup(_group: number | IEditorGroup, _location: number | IEditorGroup, _direction: GroupDirection): IEditorGroup {
725
		throw new Error('not implemented');
726
	}
727 728 729 730 731 732 733 734 735 736 737

	centerLayout(active: boolean): void { }

	isLayoutCentered(): boolean {
		return false;
	}

	partOptions: IEditorPartOptions;
	enforcePartOptions(options: IEditorPartOptions): IDisposable {
		return Disposable.None;
	}
738 739
}

B
Benjamin Pasero 已提交
740
export class TestEditorGroup implements IEditorGroupView {
741 742 743

	constructor(public id: number) { }

744
	get group(): EditorGroup { throw new Error('not implemented'); }
745
	activeControl: IActiveEditor;
746 747 748
	activeEditor: IEditorInput;
	previewEditor: IEditorInput;
	count: number;
B
Benjamin Pasero 已提交
749
	disposed: boolean;
B
Benjamin Pasero 已提交
750
	editors: ReadonlyArray<IEditorInput> = [];
751
	label: string;
R
Rob Lourens 已提交
752
	whenRestored: Promise<void> = Promise.resolve(undefined);
B
Benjamin Pasero 已提交
753 754 755 756 757
	element: HTMLElement;
	minimumWidth: number;
	maximumWidth: number;
	minimumHeight: number;
	maximumHeight: number;
758 759

	onWillDispose: Event<void> = Event.None;
760
	onDidGroupChange: Event<IGroupChangeEvent> = Event.None;
B
Benjamin Pasero 已提交
761 762
	onWillCloseEditor: Event<IEditorCloseEvent> = Event.None;
	onDidCloseEditor: Event<IEditorCloseEvent> = Event.None;
763 764
	onWillOpenEditor: Event<IEditorOpeningEvent> = Event.None;
	onDidOpenEditorFail: Event<IEditorInput> = Event.None;
B
Benjamin Pasero 已提交
765 766
	onDidFocus: Event<void> = Event.None;
	onDidChange: Event<{ width: number; height: number; }> = Event.None;
767

768
	getEditors(_order?: EditorsOrder): ReadonlyArray<IEditorInput> {
B
Benjamin Pasero 已提交
769 770 771
		return [];
	}

772
	getEditor(_index: number): IEditorInput {
773
		throw new Error('not implemented');
774 775
	}

776
	getIndexOfEditor(_editor: IEditorInput): number {
777 778 779
		return -1;
	}

J
Johannes Rieken 已提交
780
	openEditor(_editor: IEditorInput, _options?: IEditorOptions): Promise<IEditor> {
781
		throw new Error('not implemented');
782 783
	}

J
Johannes Rieken 已提交
784
	openEditors(_editors: IEditorInputWithOptions[]): Promise<IEditor> {
785
		throw new Error('not implemented');
786 787
	}

788
	isOpened(_editor: IEditorInput): boolean {
789 790 791
		return false;
	}

792
	isPinned(_editor: IEditorInput): boolean {
793 794 795
		return false;
	}

796
	isActive(_editor: IEditorInput): boolean {
797 798 799
		return false;
	}

800
	moveEditor(_editor: IEditorInput, _target: IEditorGroup, _options?: IMoveEditorOptions): void { }
801

802
	copyEditor(_editor: IEditorInput, _target: IEditorGroup, _options?: ICopyEditorOptions): void { }
803

804
	closeEditor(_editor?: IEditorInput, options?: ICloseEditorOptions): Promise<void> {
B
Benjamin Pasero 已提交
805
		return Promise.resolve();
806 807
	}

808
	closeEditors(_editors: IEditorInput[] | { except?: IEditorInput; direction?: CloseDirection; savedOnly?: boolean; }, options?: ICloseEditorOptions): Promise<void> {
B
Benjamin Pasero 已提交
809
		return Promise.resolve();
810 811
	}

J
Johannes Rieken 已提交
812
	closeAllEditors(): Promise<void> {
B
Benjamin Pasero 已提交
813
		return Promise.resolve();
814 815
	}

J
Johannes Rieken 已提交
816
	replaceEditors(_editors: IEditorReplacement[]): Promise<void> {
B
Benjamin Pasero 已提交
817
		return Promise.resolve();
818 819
	}

820
	pinEditor(_editor?: IEditorInput): void { }
821 822 823 824

	focus(): void { }

	invokeWithinContext<T>(fn: (accessor: ServicesAccessor) => T): T {
825
		throw new Error('not implemented');
826
	}
B
Benjamin Pasero 已提交
827 828

	isEmpty(): boolean { return true; }
829 830
	setActive(_isActive: boolean): void { }
	setLabel(_label: string): void { }
B
Benjamin Pasero 已提交
831 832
	dispose(): void { }
	toJSON(): object { return Object.create(null); }
833
	layout(_width: number, _height: number): void { }
834
	relayout() { }
835 836
}

B
Benjamin Pasero 已提交
837
export class TestEditorService implements EditorServiceImpl {
838 839 840 841 842

	_serviceBrand: ServiceIdentifier<any>;

	onDidActiveEditorChange: Event<void> = Event.None;
	onDidVisibleEditorsChange: Event<void> = Event.None;
B
Benjamin Pasero 已提交
843
	onDidCloseEditor: Event<IEditorCloseEvent> = Event.None;
844 845
	onDidOpenEditorFail: Event<IEditorIdentifier> = Event.None;

M
Matt Bierner 已提交
846
	activeControl: IActiveEditor;
847
	activeTextEditorWidget: any;
848
	activeEditor: IEditorInput;
849
	editors: ReadonlyArray<IEditorInput> = [];
B
Benjamin Pasero 已提交
850
	visibleControls: ReadonlyArray<IEditor> = [];
851
	visibleTextEditorWidgets = [];
B
Benjamin Pasero 已提交
852
	visibleEditors: ReadonlyArray<IEditorInput> = [];
853

854
	overrideOpenEditor(_handler: IOpenEditorOverrideHandler): IDisposable {
R
Rob Lourens 已提交
855
		return toDisposable(() => undefined);
856 857
	}

858 859
	openEditor(_editor: any, _options?: any, _group?: any): Promise<any> {
		throw new Error('not implemented');
860 861
	}

862 863
	openEditors(_editors: any, _group?: any): Promise<IEditor[]> {
		throw new Error('not implemented');
864 865
	}

866
	isOpen(_editor: IEditorInput | IResourceInput | IUntitledResourceInput): boolean {
867 868 869
		return false;
	}

870
	getOpened(_editor: IEditorInput | IResourceInput | IUntitledResourceInput): IEditorInput {
871
		throw new Error('not implemented');
872 873
	}

874
	replaceEditors(_editors: any, _group: any) {
R
Rob Lourens 已提交
875
		return Promise.resolve(undefined);
876 877
	}

878
	invokeWithinEditorContext<T>(fn: (accessor: ServicesAccessor) => T): T {
879
		throw new Error('not implemented');
880 881
	}

882
	createInput(_input: IResourceInput | IUntitledResourceInput | IResourceDiffInput | IResourceSideBySideInput): IEditorInput {
883
		throw new Error('not implemented');
884 885 886
	}
}

887 888 889 890
export class TestFileService implements IFileService {

	public _serviceBrand: any;

891 892
	public encoding: IResourceEncodings;

M
Matt Bierner 已提交
893 894
	private readonly _onFileChanges: Emitter<FileChangesEvent>;
	private readonly _onAfterOperation: Emitter<FileOperationEvent>;
895

896 897
	private content = 'Hello Html';

898 899 900 901 902
	constructor() {
		this._onFileChanges = new Emitter<FileChangesEvent>();
		this._onAfterOperation = new Emitter<FileOperationEvent>();
	}

903 904 905 906 907 908 909 910
	public setContent(content: string): void {
		this.content = content;
	}

	public getContent(): string {
		return this.content;
	}

911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926
	public get onFileChanges(): Event<FileChangesEvent> {
		return this._onFileChanges.event;
	}

	public fireFileChanges(event: FileChangesEvent): void {
		this._onFileChanges.fire(event);
	}

	public get onAfterOperation(): Event<FileOperationEvent> {
		return this._onAfterOperation.event;
	}

	public fireAfterOperation(event: FileOperationEvent): void {
		this._onAfterOperation.fire(event);
	}

J
Johannes Rieken 已提交
927
	resolveFile(resource: URI, _options?: IResolveFileOptions): Promise<IFileStat> {
B
Benjamin Pasero 已提交
928
		return Promise.resolve({
929 930
			resource,
			etag: Date.now().toString(),
B
Benjamin Pasero 已提交
931
			encoding: 'utf8',
B
Benjamin Pasero 已提交
932
			mtime: Date.now(),
933
			isDirectory: false,
B
Benjamin Pasero 已提交
934
			name: resources.basename(resource)
B
Benjamin Pasero 已提交
935
		});
936
	}
B
Benjamin Pasero 已提交
937

J
Johannes Rieken 已提交
938
	resolveFiles(toResolve: { resource: URI, options?: IResolveFileOptions }[]): Promise<IResolveFileResult[]> {
B
Benjamin Pasero 已提交
939
		return Promise.all(toResolve.map(resourceAndOption => this.resolveFile(resourceAndOption.resource, resourceAndOption.options))).then(stats => stats.map(stat => ({ stat, success: true })));
I
isidor 已提交
940 941
	}

J
Johannes Rieken 已提交
942
	existsFile(_resource: URI): Promise<boolean> {
B
Benjamin Pasero 已提交
943
		return Promise.resolve(true);
944
	}
B
Benjamin Pasero 已提交
945

J
Johannes Rieken 已提交
946
	resolveContent(resource: URI, _options?: IResolveContentOptions): Promise<IContent> {
B
Benjamin Pasero 已提交
947
		return Promise.resolve({
B
Benjamin Pasero 已提交
948
			resource: resource,
949
			value: this.content,
950
			etag: 'index.txt',
B
Benjamin Pasero 已提交
951 952
			encoding: 'utf8',
			mtime: Date.now(),
B
Benjamin Pasero 已提交
953
			name: resources.basename(resource)
E
Erich Gamma 已提交
954
		});
955
	}
E
Erich Gamma 已提交
956

J
Johannes Rieken 已提交
957
	resolveStreamContent(resource: URI, _options?: IResolveContentOptions): Promise<IStreamContent> {
B
Benjamin Pasero 已提交
958
		return Promise.resolve({
A
Alex Dima 已提交
959 960
			resource: resource,
			value: {
961
				on: (event: string, callback: Function): void => {
A
Alex Dima 已提交
962
					if (event === 'data') {
963
						callback(this.content);
A
Alex Dima 已提交
964 965 966 967 968 969 970 971
					}
					if (event === 'end') {
						callback();
					}
				}
			},
			etag: 'index.txt',
			encoding: 'utf8',
B
Benjamin Pasero 已提交
972
			mtime: Date.now(),
B
Benjamin Pasero 已提交
973
			name: resources.basename(resource)
A
Alex Dima 已提交
974
		});
975 976
	}

J
Johannes Rieken 已提交
977
	updateContent(resource: URI, _value: string | ITextSnapshot, _options?: IUpdateContentOptions): Promise<IFileStat> {
B
Benjamin Pasero 已提交
978
		return timeout(0).then(() => ({
979 980 981 982 983
			resource,
			etag: 'index.txt',
			encoding: 'utf8',
			mtime: Date.now(),
			isDirectory: false,
B
Benjamin Pasero 已提交
984
			name: resources.basename(resource)
B
Benjamin Pasero 已提交
985
		}));
986
	}
D
Daniel Imms 已提交
987

J
Johannes Rieken 已提交
988
	moveFile(_source: URI, _target: URI, _overwrite?: boolean): Promise<IFileStat> {
989
		return Promise.resolve(null!);
990
	}
D
Daniel Imms 已提交
991

J
Johannes Rieken 已提交
992
	copyFile(_source: URI, _target: URI, _overwrite?: boolean): Promise<IFileStat> {
993
		throw new Error('not implemented');
994
	}
D
Daniel Imms 已提交
995

J
Johannes Rieken 已提交
996
	createFile(_resource: URI, _content?: string, _options?: ICreateFileOptions): Promise<IFileStat> {
997
		throw new Error('not implemented');
E
Erich Gamma 已提交
998
	}
999

C
Christof Marti 已提交
1000
	readFolder(_resource: URI) {
B
Benjamin Pasero 已提交
1001
		return Promise.resolve([]);
C
Christof Marti 已提交
1002 1003
	}

J
Johannes Rieken 已提交
1004
	createFolder(_resource: URI): Promise<IFileStat> {
1005
		throw new Error('not implemented');
1006 1007
	}

1008 1009
	onDidChangeFileSystemProviderRegistrations = Event.None;

1010
	registerProvider(_scheme: string, _provider) {
1011 1012 1013
		return { dispose() { } };
	}

1014 1015
	activateProvider(_scheme: string): Promise<void> {
		throw new Error('not implemented');
1016 1017
	}

1018 1019 1020 1021
	canHandleResource(resource: URI): boolean {
		return resource.scheme === 'file';
	}

J
Johannes Rieken 已提交
1022
	del(_resource: URI, _options?: { useTrash?: boolean, recursive?: boolean }): Promise<void> {
1023
		return Promise.resolve();
1024 1025
	}

1026
	watchFileChanges(_resource: URI): void {
1027 1028
	}

1029
	unwatchFileChanges(_resource: URI): void {
1030 1031
	}

1032
	getWriteEncoding(_resource: URI): string {
1033 1034
		return 'utf8';
	}
D
Daniel Imms 已提交
1035

1036
	dispose(): void {
E
Erich Gamma 已提交
1037
	}
1038
}
1039

1040 1041
export class TestBackupFileService implements IBackupFileService {
	public _serviceBrand: any;
1042

J
Johannes Rieken 已提交
1043
	public hasBackups(): Promise<boolean> {
B
Benjamin Pasero 已提交
1044
		return Promise.resolve(false);
1045 1046
	}

J
Johannes Rieken 已提交
1047
	public hasBackup(_resource: URI): Promise<boolean> {
B
Benjamin Pasero 已提交
1048
		return Promise.resolve(false);
1049 1050
	}

1051
	public loadBackupResource(resource: URI): Promise<URI | undefined> {
B
Benjamin Pasero 已提交
1052 1053
		return this.hasBackup(resource).then(hasBackup => {
			if (hasBackup) {
1054
				return this.toBackupResource(resource);
B
Benjamin Pasero 已提交
1055 1056
			}

R
Rob Lourens 已提交
1057
			return undefined;
B
Benjamin Pasero 已提交
1058 1059 1060
		});
	}

J
Johannes Rieken 已提交
1061
	public registerResourceForBackup(_resource: URI): Promise<void> {
B
Benjamin Pasero 已提交
1062
		return Promise.resolve();
D
Daniel Imms 已提交
1063 1064
	}

J
Johannes Rieken 已提交
1065
	public deregisterResourceForBackup(_resource: URI): Promise<void> {
B
Benjamin Pasero 已提交
1066
		return Promise.resolve();
D
Daniel Imms 已提交
1067 1068
	}

1069
	public toBackupResource(_resource: URI): URI {
1070
		throw new Error('not implemented');
D
Daniel Imms 已提交
1071
	}
1072

J
Johannes Rieken 已提交
1073
	public backupResource(_resource: URI, _content: ITextSnapshot): Promise<void> {
B
Benjamin Pasero 已提交
1074
		return Promise.resolve();
1075 1076
	}

J
Johannes Rieken 已提交
1077
	public getWorkspaceFileBackups(): Promise<URI[]> {
B
Benjamin Pasero 已提交
1078
		return Promise.resolve([]);
1079 1080
	}

1081 1082 1083 1084 1085
	public parseBackupContent(textBufferFactory: ITextBufferFactory): string {
		const textBuffer = textBufferFactory.create(DefaultEndOfLine.LF);
		const lineCount = textBuffer.getLineCount();
		const range = new Range(1, 1, lineCount, textBuffer.getLineLength(lineCount) + 1);
		return textBuffer.getValueInRange(range, EndOfLinePreference.TextDefined);
1086 1087
	}

J
Johannes Rieken 已提交
1088
	public resolveBackupContent(_backup: URI): Promise<ITextBufferFactory> {
1089
		throw new Error('not implemented');
1090 1091
	}

J
Johannes Rieken 已提交
1092
	public discardResourceBackup(_resource: URI): Promise<void> {
B
Benjamin Pasero 已提交
1093
		return Promise.resolve();
1094 1095
	}

J
Johannes Rieken 已提交
1096
	public discardAllWorkspaceBackups(): Promise<void> {
B
Benjamin Pasero 已提交
1097
		return Promise.resolve();
1098
	}
1099
}
D
Daniel Imms 已提交
1100

B
Benjamin Pasero 已提交
1101 1102 1103 1104 1105 1106 1107
export class TestCodeEditorService implements ICodeEditorService {
	_serviceBrand: any;

	onCodeEditorAdd: Event<ICodeEditor> = Event.None;
	onCodeEditorRemove: Event<ICodeEditor> = Event.None;
	onDiffEditorAdd: Event<IDiffEditor> = Event.None;
	onDiffEditorRemove: Event<IDiffEditor> = Event.None;
A
Alex Dima 已提交
1108
	onDidChangeTransientModelProperty: Event<ITextModel> = Event.None;
B
Benjamin Pasero 已提交
1109

1110 1111
	addCodeEditor(_editor: ICodeEditor): void { }
	removeCodeEditor(_editor: ICodeEditor): void { }
B
Benjamin Pasero 已提交
1112
	listCodeEditors(): ICodeEditor[] { return []; }
1113 1114
	addDiffEditor(_editor: IDiffEditor): void { }
	removeDiffEditor(_editor: IDiffEditor): void { }
B
Benjamin Pasero 已提交
1115
	listDiffEditors(): IDiffEditor[] { return []; }
1116
	getFocusedCodeEditor(): ICodeEditor | null { return null; }
1117 1118 1119 1120 1121
	registerDecorationType(_key: string, _options: IDecorationRenderOptions, _parentTypeKey?: string): void { }
	removeDecorationType(_key: string): void { }
	resolveDecorationOptions(_typeKey: string, _writable: boolean): IModelDecorationOptions { return Object.create(null); }
	setTransientModelProperty(_model: ITextModel, _key: string, _value: any): void { }
	getTransientModelProperty(_model: ITextModel, _key: string) { }
1122 1123
	getActiveCodeEditor(): ICodeEditor | null { return null; }
	openCodeEditor(_input: IResourceInput, _source: ICodeEditor, _sideBySide?: boolean): Promise<ICodeEditor | null> { return Promise.resolve(null); }
B
Benjamin Pasero 已提交
1124 1125
}

1126 1127 1128 1129
export class TestWindowService implements IWindowService {

	public _serviceBrand: any;

1130
	onDidChangeFocus: Event<boolean> = new Emitter<boolean>().event;
S
SteVen Batten 已提交
1131
	onDidChangeMaximize: Event<boolean>;
1132

1133 1134
	hasFocus = true;

J
Johannes Rieken 已提交
1135
	isFocused(): Promise<boolean> {
B
Benjamin Pasero 已提交
1136
		return Promise.resolve(false);
1137 1138
	}

J
Johannes Rieken 已提交
1139
	isMaximized(): Promise<boolean> {
B
Benjamin Pasero 已提交
1140
		return Promise.resolve(false);
S
SteVen Batten 已提交
1141 1142
	}

1143 1144 1145 1146
	getConfiguration(): IWindowConfiguration {
		return Object.create(null);
	}

1147 1148 1149 1150
	getCurrentWindowId(): number {
		return 0;
	}

J
Johannes Rieken 已提交
1151
	pickFileFolderAndOpen(_options: INativeOpenDialogOptions): Promise<void> {
B
Benjamin Pasero 已提交
1152
		return Promise.resolve();
1153 1154
	}

J
Johannes Rieken 已提交
1155
	pickFileAndOpen(_options: INativeOpenDialogOptions): Promise<void> {
B
Benjamin Pasero 已提交
1156
		return Promise.resolve();
1157 1158
	}

J
Johannes Rieken 已提交
1159
	pickFolderAndOpen(_options: INativeOpenDialogOptions): Promise<void> {
B
Benjamin Pasero 已提交
1160
		return Promise.resolve();
1161 1162
	}

J
Johannes Rieken 已提交
1163
	pickWorkspaceAndOpen(_options: INativeOpenDialogOptions): Promise<void> {
B
Benjamin Pasero 已提交
1164
		return Promise.resolve();
1165 1166
	}

J
Johannes Rieken 已提交
1167
	reloadWindow(): Promise<void> {
B
Benjamin Pasero 已提交
1168
		return Promise.resolve();
1169 1170
	}

J
Johannes Rieken 已提交
1171
	openDevTools(): Promise<void> {
B
Benjamin Pasero 已提交
1172
		return Promise.resolve();
1173 1174
	}

J
Johannes Rieken 已提交
1175
	toggleDevTools(): Promise<void> {
B
Benjamin Pasero 已提交
1176
		return Promise.resolve();
1177 1178
	}

J
Johannes Rieken 已提交
1179
	closeWorkspace(): Promise<void> {
B
Benjamin Pasero 已提交
1180
		return Promise.resolve();
1181 1182
	}

M
Matt Bierner 已提交
1183
	enterWorkspace(_path: URI): Promise<IEnterWorkspaceResult | undefined> {
J
Johannes Rieken 已提交
1184
		return Promise.resolve(undefined);
1185 1186
	}

J
Johannes Rieken 已提交
1187
	toggleFullScreen(): Promise<void> {
B
Benjamin Pasero 已提交
1188
		return Promise.resolve();
1189 1190
	}

J
Johannes Rieken 已提交
1191
	setRepresentedFilename(_fileName: string): Promise<void> {
B
Benjamin Pasero 已提交
1192
		return Promise.resolve();
1193 1194
	}

J
Johannes Rieken 已提交
1195
	getRecentlyOpened(): Promise<IRecentlyOpened> {
1196 1197 1198 1199
		return Promise.resolve({
			workspaces: [],
			files: []
		});
1200 1201
	}

J
Johannes Rieken 已提交
1202
	focusWindow(): Promise<void> {
B
Benjamin Pasero 已提交
1203
		return Promise.resolve();
1204 1205
	}

J
Johannes Rieken 已提交
1206
	maximizeWindow(): Promise<void> {
B
Benjamin Pasero 已提交
1207
		return Promise.resolve();
S
SteVen Batten 已提交
1208 1209
	}

J
Johannes Rieken 已提交
1210
	unmaximizeWindow(): Promise<void> {
B
Benjamin Pasero 已提交
1211
		return Promise.resolve();
S
SteVen Batten 已提交
1212 1213
	}

J
Johannes Rieken 已提交
1214
	minimizeWindow(): Promise<void> {
B
Benjamin Pasero 已提交
1215
		return Promise.resolve();
S
SteVen Batten 已提交
1216 1217
	}

1218
	openWindow(_uris: IURIToOpen[], _options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean, forceOpenWorkspaceAsFile?: boolean }): Promise<void> {
B
Benjamin Pasero 已提交
1219
		return Promise.resolve();
B
Benjamin Pasero 已提交
1220 1221
	}

J
Johannes Rieken 已提交
1222
	closeWindow(): Promise<void> {
B
Benjamin Pasero 已提交
1223
		return Promise.resolve();
1224 1225
	}

J
Johannes Rieken 已提交
1226
	setDocumentEdited(_flag: boolean): Promise<void> {
B
Benjamin Pasero 已提交
1227
		return Promise.resolve();
1228 1229
	}

J
Johannes Rieken 已提交
1230
	onWindowTitleDoubleClick(): Promise<void> {
B
Benjamin Pasero 已提交
1231
		return Promise.resolve();
1232
	}
1233

J
Johannes Rieken 已提交
1234
	show(): Promise<void> {
B
Benjamin Pasero 已提交
1235
		return Promise.resolve();
J
Joao 已提交
1236 1237
	}

J
Johannes Rieken 已提交
1238
	showMessageBox(_options: Electron.MessageBoxOptions): Promise<IMessageBoxResult> {
B
Benjamin Pasero 已提交
1239
		return Promise.resolve({ button: 0 });
1240 1241
	}

J
Johannes Rieken 已提交
1242
	showSaveDialog(_options: Electron.SaveDialogOptions): Promise<string> {
1243
		throw new Error('not implemented');
1244
	}
1245

J
Johannes Rieken 已提交
1246
	showOpenDialog(_options: Electron.OpenDialogOptions): Promise<string[]> {
1247
		throw new Error('not implemented');
1248
	}
1249

J
Johannes Rieken 已提交
1250
	updateTouchBar(_items: ISerializableCommandAction[][]): Promise<void> {
B
Benjamin Pasero 已提交
1251
		return Promise.resolve();
1252
	}
1253 1254

	resolveProxy(url: string): Promise<string | undefined> {
R
Rob Lourens 已提交
1255
		return Promise.resolve(undefined);
1256
	}
1257 1258
}

1259 1260
export class TestLifecycleService implements ILifecycleService {

1261
	public _serviceBrand: any;
1262

1263
	public phase: LifecyclePhase;
1264
	public startupKind: StartupKind;
1265

1266
	private _onBeforeShutdown = new Emitter<BeforeShutdownEvent>();
1267
	private _onWillShutdown = new Emitter<WillShutdownEvent>();
1268
	private _onShutdown = new Emitter<void>();
1269

J
Johannes Rieken 已提交
1270
	when(): Promise<void> {
B
Benjamin Pasero 已提交
1271
		return Promise.resolve();
B
Benjamin Pasero 已提交
1272
	}
1273

1274
	public fireShutdown(reason = ShutdownReason.QUIT): void {
1275
		this._onWillShutdown.fire({
1276 1277 1278
			join: () => { },
			reason
		});
1279 1280
	}

1281 1282 1283 1284 1285 1286
	public fireWillShutdown(event: BeforeShutdownEvent): void {
		this._onBeforeShutdown.fire(event);
	}

	public get onBeforeShutdown(): Event<BeforeShutdownEvent> {
		return this._onBeforeShutdown.event;
1287 1288
	}

1289
	public get onWillShutdown(): Event<WillShutdownEvent> {
1290 1291 1292
		return this._onWillShutdown.event;
	}

1293
	public get onShutdown(): Event<void> {
1294 1295
		return this._onShutdown.event;
	}
1296 1297
}

1298 1299 1300 1301
export class TestWindowsService implements IWindowsService {

	_serviceBrand: any;

1302 1303
	public windowCount = 1;

1304 1305
	onWindowOpen: Event<number>;
	onWindowFocus: Event<number>;
1306
	onWindowBlur: Event<number>;
S
SteVen Batten 已提交
1307 1308
	onWindowMaximize: Event<number>;
	onWindowUnmaximize: Event<number>;
S
SteVen Batten 已提交
1309
	onRecentlyOpenedChange: Event<void>;
1310

J
Johannes Rieken 已提交
1311
	isFocused(_windowId: number): Promise<boolean> {
B
Benjamin Pasero 已提交
1312
		return Promise.resolve(false);
1313 1314
	}

J
Johannes Rieken 已提交
1315
	pickFileFolderAndOpen(_options: INativeOpenDialogOptions): Promise<void> {
B
Benjamin Pasero 已提交
1316
		return Promise.resolve();
1317
	}
1318

J
Johannes Rieken 已提交
1319
	pickFileAndOpen(_options: INativeOpenDialogOptions): Promise<void> {
B
Benjamin Pasero 已提交
1320
		return Promise.resolve();
1321
	}
1322

J
Johannes Rieken 已提交
1323
	pickFolderAndOpen(_options: INativeOpenDialogOptions): Promise<void> {
B
Benjamin Pasero 已提交
1324
		return Promise.resolve();
1325
	}
1326

J
Johannes Rieken 已提交
1327
	pickWorkspaceAndOpen(_options: INativeOpenDialogOptions): Promise<void> {
B
Benjamin Pasero 已提交
1328
		return Promise.resolve();
1329 1330
	}

J
Johannes Rieken 已提交
1331
	reloadWindow(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1332
		return Promise.resolve();
1333
	}
1334

J
Johannes Rieken 已提交
1335
	openDevTools(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1336
		return Promise.resolve();
1337
	}
1338

J
Johannes Rieken 已提交
1339
	toggleDevTools(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1340
		return Promise.resolve();
1341
	}
1342

J
Johannes Rieken 已提交
1343
	closeWorkspace(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1344
		return Promise.resolve();
1345
	}
1346

1347
	enterWorkspace(_windowId: number, _path: URI): Promise<IEnterWorkspaceResult | undefined> {
J
Johannes Rieken 已提交
1348
		return Promise.resolve(undefined);
1349 1350
	}

J
Johannes Rieken 已提交
1351
	toggleFullScreen(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1352
		return Promise.resolve();
1353
	}
1354

J
Johannes Rieken 已提交
1355
	setRepresentedFilename(_windowId: number, _fileName: string): Promise<void> {
B
Benjamin Pasero 已提交
1356
		return Promise.resolve();
1357
	}
1358

M
Martin Aeschlimann 已提交
1359
	addRecentlyOpened(_recents: IRecent[]): Promise<void> {
B
Benjamin Pasero 已提交
1360
		return Promise.resolve();
1361
	}
1362

J
Johannes Rieken 已提交
1363
	removeFromRecentlyOpened(_paths: URI[]): Promise<void> {
B
Benjamin Pasero 已提交
1364
		return Promise.resolve();
1365
	}
1366

J
Johannes Rieken 已提交
1367
	clearRecentlyOpened(): Promise<void> {
B
Benjamin Pasero 已提交
1368
		return Promise.resolve();
C
22768  
Cristian 已提交
1369
	}
1370

J
Johannes Rieken 已提交
1371
	getRecentlyOpened(_windowId: number): Promise<IRecentlyOpened> {
1372 1373 1374 1375
		return Promise.resolve({
			workspaces: [],
			files: []
		});
1376
	}
1377

J
Johannes Rieken 已提交
1378
	focusWindow(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1379
		return Promise.resolve();
1380
	}
1381

J
Johannes Rieken 已提交
1382
	closeWindow(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1383
		return Promise.resolve();
1384 1385
	}

J
Johannes Rieken 已提交
1386
	isMaximized(_windowId: number): Promise<boolean> {
1387
		return Promise.resolve(false);
1388
	}
1389

J
Johannes Rieken 已提交
1390
	maximizeWindow(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1391
		return Promise.resolve();
1392
	}
1393

J
Johannes Rieken 已提交
1394
	minimizeWindow(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1395
		return Promise.resolve();
S
SteVen Batten 已提交
1396 1397
	}

J
Johannes Rieken 已提交
1398
	unmaximizeWindow(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1399
		return Promise.resolve();
1400
	}
1401

J
Johannes Rieken 已提交
1402
	onWindowTitleDoubleClick(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1403
		return Promise.resolve();
1404
	}
1405

J
Johannes Rieken 已提交
1406
	setDocumentEdited(_windowId: number, _flag: boolean): Promise<void> {
B
Benjamin Pasero 已提交
1407
		return Promise.resolve();
1408
	}
1409

J
Johannes Rieken 已提交
1410
	quit(): Promise<void> {
B
Benjamin Pasero 已提交
1411
		return Promise.resolve();
1412
	}
1413

J
Johannes Rieken 已提交
1414
	relaunch(_options: { addArgs?: string[], removeArgs?: string[] }): Promise<void> {
B
Benjamin Pasero 已提交
1415
		return Promise.resolve();
J
Johannes Rieken 已提交
1416
	}
1417

J
Johannes Rieken 已提交
1418
	whenSharedProcessReady(): Promise<void> {
B
Benjamin Pasero 已提交
1419
		return Promise.resolve();
1420
	}
1421

J
Johannes Rieken 已提交
1422
	toggleSharedProcess(): Promise<void> {
B
Benjamin Pasero 已提交
1423
		return Promise.resolve();
1424
	}
1425

1426
	// Global methods
1427
	openWindow(_windowId: number, _uris: IURIToOpen[], _options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean, forceOpenWorkspaceAsFile?: boolean }): Promise<void> {
B
Benjamin Pasero 已提交
1428
		return Promise.resolve();
1429
	}
1430

J
Johannes Rieken 已提交
1431
	openNewWindow(): Promise<void> {
B
Benjamin Pasero 已提交
1432
		return Promise.resolve();
1433
	}
1434

J
Johannes Rieken 已提交
1435
	showWindow(_windowId: number): Promise<void> {
B
Benjamin Pasero 已提交
1436
		return Promise.resolve();
1437
	}
1438

J
Johannes Rieken 已提交
1439
	getWindows(): Promise<{ id: number; workspace?: IWorkspaceIdentifier; folderUri?: ISingleFolderWorkspaceIdentifier; title: string; filename?: string; }[]> {
1440
		throw new Error('not implemented');
1441
	}
1442

J
Johannes Rieken 已提交
1443
	getWindowCount(): Promise<number> {
B
Benjamin Pasero 已提交
1444
		return Promise.resolve(this.windowCount);
1445
	}
1446

J
Johannes Rieken 已提交
1447
	log(_severity: string, ..._messages: string[]): Promise<void> {
B
Benjamin Pasero 已提交
1448
		return Promise.resolve();
1449
	}
1450

M
Martin Aeschlimann 已提交
1451
	showItemInFolder(_path: URI): Promise<void> {
B
Benjamin Pasero 已提交
1452
		return Promise.resolve();
1453 1454
	}

J
Johannes Rieken 已提交
1455
	newWindowTab(): Promise<void> {
B
Benjamin Pasero 已提交
1456
		return Promise.resolve();
1457 1458
	}

J
Johannes Rieken 已提交
1459
	showPreviousWindowTab(): Promise<void> {
B
Benjamin Pasero 已提交
1460
		return Promise.resolve();
1461 1462
	}

J
Johannes Rieken 已提交
1463
	showNextWindowTab(): Promise<void> {
B
Benjamin Pasero 已提交
1464
		return Promise.resolve();
1465 1466
	}

J
Johannes Rieken 已提交
1467
	moveWindowTabToNewWindow(): Promise<void> {
B
Benjamin Pasero 已提交
1468
		return Promise.resolve();
1469 1470
	}

J
Johannes Rieken 已提交
1471
	mergeAllWindowTabs(): Promise<void> {
B
Benjamin Pasero 已提交
1472
		return Promise.resolve();
1473 1474
	}

J
Johannes Rieken 已提交
1475
	toggleWindowTabsBar(): Promise<void> {
B
Benjamin Pasero 已提交
1476
		return Promise.resolve();
1477 1478
	}

J
Johannes Rieken 已提交
1479
	updateTouchBar(_windowId: number, _items: ISerializableCommandAction[][]): Promise<void> {
B
Benjamin Pasero 已提交
1480
		return Promise.resolve();
1481 1482
	}

J
Johannes Rieken 已提交
1483
	getActiveWindowId(): Promise<number | undefined> {
B
Benjamin Pasero 已提交
1484
		return Promise.resolve(undefined);
J
Joao Moreno 已提交
1485 1486
	}

1487 1488
	// This needs to be handled from browser process to prevent
	// foreground ordering issues on Windows
J
Johannes Rieken 已提交
1489
	openExternal(_url: string): Promise<boolean> {
B
Benjamin Pasero 已提交
1490
		return Promise.resolve(true);
1491 1492 1493
	}

	// TODO: this is a bit backwards
J
Johannes Rieken 已提交
1494
	startCrashReporter(_config: Electron.CrashReporterStartOptions): Promise<void> {
B
Benjamin Pasero 已提交
1495
		return Promise.resolve();
1496
	}
1497

J
Johannes Rieken 已提交
1498
	showMessageBox(_windowId: number, _options: Electron.MessageBoxOptions): Promise<IMessageBoxResult> {
1499
		throw new Error('not implemented');
1500 1501
	}

J
Johannes Rieken 已提交
1502
	showSaveDialog(_windowId: number, _options: Electron.SaveDialogOptions): Promise<string> {
1503
		throw new Error('not implemented');
1504 1505
	}

J
Johannes Rieken 已提交
1506
	showOpenDialog(_windowId: number, _options: Electron.OpenDialogOptions): Promise<string[]> {
1507
		throw new Error('not implemented');
1508
	}
J
Joao Moreno 已提交
1509

J
Johannes Rieken 已提交
1510
	openAboutDialog(): Promise<void> {
B
Benjamin Pasero 已提交
1511
		return Promise.resolve();
J
Joao Moreno 已提交
1512
	}
1513 1514

	resolveProxy(windowId: number, url: string): Promise<string | undefined> {
R
Rob Lourens 已提交
1515
		return Promise.resolve(undefined);
1516
	}
1517
}
B
Benjamin Pasero 已提交
1518

1519 1520 1521 1522 1523 1524 1525
export class TestTextResourceConfigurationService implements ITextResourceConfigurationService {

	_serviceBrand: any;

	constructor(private configurationService = new TestConfigurationService()) {
	}

1526
	public onDidChangeConfiguration() {
1527 1528 1529
		return { dispose() { } };
	}

1530
	getValue<T>(resource: URI, arg2?: any, arg3?: any): T {
1531 1532
		const position: IPosition | null = EditorPosition.isIPosition(arg2) ? arg2 : null;
		const section: string | undefined = position ? (typeof arg3 === 'string' ? arg3 : undefined) : (typeof arg2 === 'string' ? arg2 : undefined);
1533
		return this.configurationService.getValue(section, { resource });
1534
	}
B
Benjamin Pasero 已提交
1535 1536
}

S
Sandeep Somavarapu 已提交
1537 1538 1539 1540 1541
export class TestTextResourcePropertiesService implements ITextResourcePropertiesService {

	_serviceBrand: any;

	constructor(
1542
		@IConfigurationService private readonly configurationService: IConfigurationService,
S
Sandeep Somavarapu 已提交
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557
	) {
	}

	getEOL(resource: URI): string {
		const filesConfiguration = this.configurationService.getValue<{ eol: string }>('files');
		if (filesConfiguration && filesConfiguration.eol) {
			if (filesConfiguration.eol !== 'auto') {
				return filesConfiguration.eol;
			}
		}
		return (isLinux || isMacintosh) ? '\n' : '\r\n';
	}
}


R
Ramya Achutha Rao 已提交
1558 1559 1560 1561 1562 1563
export class TestHashService implements IHashService {
	_serviceBrand: any;

	createSHA1(content: string): string {
		return content;
	}
1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574
}

export class TestSharedProcessService implements ISharedProcessService {

	_serviceBrand: ServiceIdentifier<any>;

	getChannel(channelName: string): any {
		return undefined;
	}

	registerChannel(channelName: string, channel: any): void { }
1575
}