Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/vs/workbench/test/browser/workbenchTestServices.ts')
-rw-r--r--src/vs/workbench/test/browser/workbenchTestServices.ts56
1 files changed, 50 insertions, 6 deletions
diff --git a/src/vs/workbench/test/browser/workbenchTestServices.ts b/src/vs/workbench/test/browser/workbenchTestServices.ts
index fbd98039411..62e691e60bb 100644
--- a/src/vs/workbench/test/browser/workbenchTestServices.ts
+++ b/src/vs/workbench/test/browser/workbenchTestServices.ts
@@ -7,7 +7,7 @@ import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/file
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { basename, isEqual } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
-import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
+import { ITelemetryData, ITelemetryService, TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { EditorInputWithOptions, IEditorIdentifier, IUntitledTextResourceEditorInput, IResourceDiffEditorInput, IEditorPane, IEditorCloseEvent, IEditorPartOptions, IRevertOptions, GroupIdentifier, EditorsOrder, IFileEditorInput, IEditorFactoryRegistry, IEditorSerializer, EditorExtensions, ISaveOptions, IMoveResult, ITextDiffEditorPane, IVisibleEditorPane, IEditorOpenContext, EditorExtensions as Extensions, EditorInputCapabilities, IUntypedEditorInput, IEditorWillMoveEvent, IEditorWillOpenEvent, IActiveEditorChangeEvent, EditorPaneSelectionChangeReason, IEditorPaneSelection } from 'vs/workbench/common/editor';
@@ -21,7 +21,7 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { IEditorOptions, IResourceEditorInput, IEditorModel, IResourceEditorInputIdentifier, ITextResourceEditorInput, ITextEditorOptions } from 'vs/platform/editor/common/editor';
import { IUntitledTextEditorService, UntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
import { IWorkspaceContextService, IWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
-import { ILifecycleService, ShutdownReason, StartupKind, LifecyclePhase, WillShutdownEvent, BeforeShutdownErrorEvent, InternalBeforeShutdownEvent } from 'vs/workbench/services/lifecycle/common/lifecycle';
+import { ILifecycleService, ShutdownReason, StartupKind, LifecyclePhase, WillShutdownEvent, BeforeShutdownErrorEvent, InternalBeforeShutdownEvent, IWillShutdownEventJoiner } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { FileOperationEvent, IFileService, IFileStat, IFileStatResult, FileChangesEvent, IResolveFileOptions, ICreateFileOptions, IFileSystemProvider, FileSystemProviderCapabilities, IFileChange, IWatchOptions, IStat, FileType, IFileDeleteOptions, IFileOverwriteOptions, IFileWriteOptions, IFileOpenOptions, IFileStatWithMetadata, IResolveMetadataFileOptions, IWriteFileOptions, IReadFileOptions, IFileContent, IFileStreamContent, FileOperationError, IFileSystemProviderWithFileReadStreamCapability, IFileReadStreamOptions, IReadFileStreamOptions, IFileSystemProviderCapabilitiesChangeEvent, IFileStatWithPartialMetadata } from 'vs/platform/files/common/files';
import { IModelService } from 'vs/editor/common/services/model';
@@ -153,6 +153,12 @@ import { TextEditorPaneSelection } from 'vs/workbench/browser/parts/editor/textE
import { Selection } from 'vs/editor/common/core/selection';
import { IFolderBackupInfo, IWorkspaceBackupInfo } from 'vs/platform/backup/common/backup';
import { TestEditorWorkerService } from 'vs/editor/test/common/services/testEditorWorkerService';
+import { IExtensionHostExitInfo, IRemoteAgentConnection, IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
+import { ILanguageDetectionService } from 'vs/workbench/services/languageDetection/common/languageDetectionWorkerService';
+import { IDiagnosticInfoOptions, IDiagnosticInfo } from 'vs/platform/diagnostics/common/diagnostics';
+import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
+import { ISocketFactory } from 'vs/platform/remote/common/remoteAgentConnection';
+import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment';
export function createFileEditorInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
return instantiationService.createInstance(FileEditorInput, resource, undefined, undefined, undefined, undefined, undefined, undefined);
@@ -252,6 +258,8 @@ export function workbenchInstantiationService(
instantiationService.stub(ITextResourceConfigurationService, new TestTextResourceConfigurationService(configService));
instantiationService.stub(IUntitledTextEditorService, disposables.add(instantiationService.createInstance(UntitledTextEditorService)));
instantiationService.stub(IStorageService, disposables.add(new TestStorageService()));
+ instantiationService.stub(IRemoteAgentService, new TestRemoteAgentService());
+ instantiationService.stub(ILanguageDetectionService, new TestLanguageDetectionService());
instantiationService.stub(IPathService, overrides?.pathService ? overrides.pathService(instantiationService) : new TestPathService());
const layoutService = new TestLayoutService();
instantiationService.stub(IWorkbenchLayoutService, layoutService);
@@ -865,7 +873,7 @@ export class TestEditorGroupView implements IEditorGroupView {
copyEditors(_editors: EditorInputWithOptions[], _target: IEditorGroup): void { }
async closeEditor(_editor?: EditorInput, options?: ICloseEditorOptions): Promise<boolean> { return true; }
async closeEditors(_editors: EditorInput[] | ICloseEditorsFilter, options?: ICloseEditorOptions): Promise<boolean> { return true; }
- async closeAllEditors(options?: ICloseAllEditorsOptions): Promise<void> { }
+ async closeAllEditors(options?: ICloseAllEditorsOptions): Promise<boolean> { return true; }
async replaceEditors(_editors: IEditorReplacement[]): Promise<void> { }
pinEditor(_editor?: EditorInput): void { }
stickEditor(editor?: EditorInput | undefined): void { }
@@ -1227,6 +1235,7 @@ export class TestLifecycleService implements ILifecycleService {
join: p => {
this.shutdownJoiners.push(p);
},
+ joiners: () => [],
force: () => { /* No-Op in tests */ },
token: CancellationToken.None,
reason
@@ -1261,10 +1270,11 @@ export class TestBeforeShutdownEvent implements InternalBeforeShutdownEvent {
export class TestWillShutdownEvent implements WillShutdownEvent {
value: Promise<void>[] = [];
+ joiners = () => [];
reason = ShutdownReason.CLOSE;
token = CancellationToken.None;
- join(promise: Promise<void>, id: string): void {
+ join(promise: Promise<void>, joiner: IWillShutdownEventJoiner): void {
this.value.push(promise);
}
@@ -1675,7 +1685,7 @@ export class TestPathService implements IPathService {
declare readonly _serviceBrand: undefined;
- constructor(private readonly fallbackUserHome: URI = URI.from({ scheme: Schemas.vscodeRemote, path: '/' }), public defaultUriScheme = Schemas.vscodeRemote) { }
+ constructor(private readonly fallbackUserHome: URI = URI.from({ scheme: Schemas.file, path: '/' }), public defaultUriScheme = Schemas.file) { }
hasValidBasename(resource: URI, basename?: string): Promise<boolean>;
hasValidBasename(resource: URI, os: OperatingSystem, basename?: string): boolean;
@@ -1689,7 +1699,12 @@ export class TestPathService implements IPathService {
get path() { return Promise.resolve(isWindows ? win32 : posix); }
- async userHome() { return this.fallbackUserHome; }
+ userHome(options?: { preferLocal: boolean }): Promise<URI>;
+ userHome(options: { preferLocal: true }): URI;
+ userHome(options?: { preferLocal: boolean }): Promise<URI> | URI {
+ return options?.preferLocal ? this.fallbackUserHome : Promise.resolve(this.fallbackUserHome);
+ }
+
get resolvedUserHome() { return this.fallbackUserHome; }
async fileURI(path: string): Promise<URI> {
@@ -1874,3 +1889,32 @@ export class TestQuickInputService implements IQuickInputService {
back(): Promise<void> { throw new Error('not implemented.'); }
cancel(): Promise<void> { throw new Error('not implemented.'); }
}
+
+class TestLanguageDetectionService implements ILanguageDetectionService {
+
+ declare readonly _serviceBrand: undefined;
+
+ isEnabledForLanguage(languageId: string): boolean { return false; }
+ async detectLanguage(resource: URI, supportedLangs?: string[] | undefined): Promise<string | undefined> { return undefined; }
+}
+
+export class TestRemoteAgentService implements IRemoteAgentService {
+
+ declare readonly _serviceBrand: undefined;
+
+ socketFactory: ISocketFactory = {
+ connect() { }
+ };
+
+ getConnection(): IRemoteAgentConnection | null { return null; }
+ async getEnvironment(): Promise<IRemoteAgentEnvironment | null> { return null; }
+ async getRawEnvironment(): Promise<IRemoteAgentEnvironment | null> { return null; }
+ async getExtensionHostExitInfo(reconnectionToken: string): Promise<IExtensionHostExitInfo | null> { return null; }
+ async whenExtensionsReady(): Promise<void> { }
+ scanExtensions(skipExtensions?: ExtensionIdentifier[]): Promise<IExtensionDescription[]> { throw new Error('Method not implemented.'); }
+ scanSingleExtension(extensionLocation: URI, isBuiltin: boolean): Promise<IExtensionDescription | null> { throw new Error('Method not implemented.'); }
+ async getDiagnosticInfo(options: IDiagnosticInfoOptions): Promise<IDiagnosticInfo | undefined> { return undefined; }
+ async updateTelemetryLevel(telemetryLevel: TelemetryLevel): Promise<void> { }
+ async logTelemetry(eventName: string, data?: ITelemetryData): Promise<void> { }
+ async flushTelemetry(): Promise<void> { }
+}