Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae

This commit is contained in:
ADS Merger
2020-06-18 04:32:54 +00:00
committed by AzureDataStudio
parent a971aee5bd
commit 5e7071e466
1002 changed files with 24201 additions and 13193 deletions

File diff suppressed because one or more lines are too long

View File

@@ -883,9 +883,9 @@ suite('ExtHostLanguageFeatures', function () {
}, []));
await rpcProtocol.sync();
const value = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
assert.equal(value.length, 1);
assert.equal(value[0].completion.insertText, 'testing2');
const { items } = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
assert.equal(items.length, 1);
assert.equal(items[0].completion.insertText, 'testing2');
});
test('Suggest, order 2/3', async () => {
@@ -903,9 +903,9 @@ suite('ExtHostLanguageFeatures', function () {
}, []));
await rpcProtocol.sync();
const value = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
assert.equal(value.length, 1);
assert.equal(value[0].completion.insertText, 'weak-selector');
const { items } = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
assert.equal(items.length, 1);
assert.equal(items[0].completion.insertText, 'weak-selector');
});
test('Suggest, order 2/3', async () => {
@@ -923,10 +923,10 @@ suite('ExtHostLanguageFeatures', function () {
}, []));
await rpcProtocol.sync();
const value = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
assert.equal(value.length, 2);
assert.equal(value[0].completion.insertText, 'strong-1'); // sort by label
assert.equal(value[1].completion.insertText, 'strong-2');
const { items } = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
assert.equal(items.length, 2);
assert.equal(items[0].completion.insertText, 'strong-1'); // sort by label
assert.equal(items[1].completion.insertText, 'strong-2');
});
test('Suggest, evil provider', async () => {
@@ -945,8 +945,8 @@ suite('ExtHostLanguageFeatures', function () {
await rpcProtocol.sync();
const value = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
assert.equal(value[0].container.incomplete, false);
const { items } = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
assert.equal(items[0].container.incomplete, false);
});
test('Suggest, CompletionList', async () => {
@@ -958,8 +958,8 @@ suite('ExtHostLanguageFeatures', function () {
}, []));
await rpcProtocol.sync();
provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet))).then(value => {
assert.equal(value[0].container.incomplete, true);
provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet))).then(model => {
assert.equal(model.items[0].container.incomplete, true);
});
});

View File

@@ -13,7 +13,7 @@ import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
const emptyDialogService = new class implements IDialogService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
show(): never {
throw new Error('not implemented');
}
@@ -37,7 +37,7 @@ const emptyCommandService: ICommandService = {
};
const emptyNotificationService = new class implements INotificationService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
notify(...args: any[]): never {
throw new Error('not implemented');
}
@@ -62,7 +62,7 @@ const emptyNotificationService = new class implements INotificationService {
};
class EmptyNotificationService implements INotificationService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
constructor(private withNotify: (notification: INotification) => void) {
}

View File

@@ -73,7 +73,7 @@ suite('NotebookConcatDocument', function () {
});
await extHostNotebooks.$acceptDocumentAndEditorsDelta({ newActiveEditor: '_notebook_editor_0' });
notebook = extHostNotebooks.activeNotebookDocument!;
notebook = extHostNotebooks.notebookDocuments[0]!;
disposables.add(reg);
disposables.add(notebook);

View File

@@ -7,12 +7,21 @@
import * as assert from 'assert';
import { MarkdownString, LogLevel } from 'vs/workbench/api/common/extHostTypeConverters';
import { isEmptyObject } from 'vs/base/common/types';
import { size, forEach } from 'vs/base/common/collections';
import { forEach } from 'vs/base/common/collections';
import * as types from 'vs/workbench/api/common/extHostTypes';
import { LogLevel as _MainLogLevel } from 'vs/platform/log/common/log';
import { URI } from 'vs/base/common/uri';
suite('ExtHostTypeConverter', function () {
function size<T>(from: Record<any, any>): number {
let count = 0;
for (let key in from) {
if (Object.prototype.hasOwnProperty.call(from, key)) {
count += 1;
}
}
return count;
}
test('MarkdownConvert - uris', function () {

View File

@@ -8,10 +8,11 @@ import { BoundModelReferenceCollection } from 'vs/workbench/api/browser/mainThre
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
import { timeout } from 'vs/base/common/async';
import { URI } from 'vs/base/common/uri';
import { extUri } from 'vs/base/common/resources';
suite('BoundModelReferenceCollection', () => {
let col = new BoundModelReferenceCollection(15, 75);
let col = new BoundModelReferenceCollection(extUri, 15, 75);
teardown(() => {
col.dispose();

View File

@@ -27,6 +27,7 @@ import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogSer
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
import { TestTextResourcePropertiesService, TestWorkingCopyFileService } from 'vs/workbench/test/common/workbenchTestServices';
import { UriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentityService';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
suite('MainThreadDocumentsAndEditors', () => {
@@ -67,6 +68,8 @@ suite('MainThreadDocumentsAndEditors', () => {
const fileService = new class extends mock<IFileService>() {
onDidRunOperation = Event.None;
onDidChangeFileSystemProviderCapabilities = Event.None;
onDidChangeFileSystemProviderRegistrations = Event.None;
};
new MainThreadDocumentsAndEditors(
@@ -82,7 +85,7 @@ suite('MainThreadDocumentsAndEditors', () => {
editorGroupService,
null!,
new class extends mock<IPanelService>() implements IPanelService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
onDidPanelOpen = Event.None;
onDidPanelClose = Event.None;
getActivePanel() {
@@ -92,6 +95,11 @@ suite('MainThreadDocumentsAndEditors', () => {
TestEnvironmentService,
new TestWorkingCopyFileService(),
new UriIdentityService(fileService),
new class extends mock<IClipboardService>() {
readText() {
return Promise.resolve('clipboard_contents');
}
}
);
});

View File

@@ -48,6 +48,8 @@ import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { TestTextResourcePropertiesService, TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
import { extUri } from 'vs/base/common/resources';
suite('MainThreadEditors', () => {
@@ -131,13 +133,16 @@ suite('MainThreadEditors', () => {
});
services.set(IPanelService, new class extends mock<IPanelService>() implements IPanelService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
onDidPanelOpen = Event.None;
onDidPanelClose = Event.None;
getActivePanel() {
return undefined;
}
});
services.set(IUriIdentityService, new class extends mock<IUriIdentityService>() {
get extUri() { return extUri; }
});
const instaService = new InstantiationService(services);

View File

@@ -20,6 +20,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorModel } from 'vs/platform/editor/common/editor';
import { dispose } from 'vs/base/common/lifecycle';
import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices';
import { extUri } from 'vs/base/common/resources';
const NullThemeService = new TestThemeService();
@@ -158,10 +159,10 @@ suite('Workbench base editor', () => {
let inst = workbenchInstantiationService();
const editor = EditorRegistry.getEditor(inst.createInstance(MyResourceEditorInput, 'fake', '', URI.file('/fake'), undefined))!.instantiate(inst);
const editor = EditorRegistry.getEditor(inst.createInstance(MyResourceEditorInput, URI.file('/fake'), 'fake', '', undefined))!.instantiate(inst);
assert.strictEqual(editor.getId(), 'myEditor');
const otherEditor = EditorRegistry.getEditor(inst.createInstance(ResourceEditorInput, 'fake', '', URI.file('/fake'), undefined))!.instantiate(inst);
const otherEditor = EditorRegistry.getEditor(inst.createInstance(ResourceEditorInput, URI.file('/fake'), 'fake', '', undefined))!.instantiate(inst);
assert.strictEqual(otherEditor.getId(), 'workbench.editors.textResourceEditor');
disposable.dispose();
@@ -170,7 +171,7 @@ suite('Workbench base editor', () => {
test('Editor Lookup favors specific class over superclass (match on super class)', function () {
let inst = workbenchInstantiationService();
const editor = EditorRegistry.getEditor(inst.createInstance(MyResourceEditorInput, 'fake', '', URI.file('/fake'), undefined))!.instantiate(inst);
const editor = EditorRegistry.getEditor(inst.createInstance(MyResourceEditorInput, URI.file('/fake'), 'fake', '', undefined))!.instantiate(inst);
assert.strictEqual('workbench.editors.textResourceEditor', editor.getId());
});
@@ -266,7 +267,7 @@ suite('Workbench base editor', () => {
memento.saveEditorState(testGroup0, URI.file('/some/folder/file-2.txt'), { line: 2 });
memento.saveEditorState(testGroup0, URI.file('/some/other/file.txt'), { line: 3 });
memento.moveEditorState(URI.file('/some/folder/file-1.txt'), URI.file('/some/folder/file-moved.txt'));
memento.moveEditorState(URI.file('/some/folder/file-1.txt'), URI.file('/some/folder/file-moved.txt'), extUri);
let res = memento.loadEditorState(testGroup0, URI.file('/some/folder/file-1.txt'));
assert.ok(!res);
@@ -274,7 +275,7 @@ suite('Workbench base editor', () => {
res = memento.loadEditorState(testGroup0, URI.file('/some/folder/file-moved.txt'));
assert.equal(res?.line, 1);
memento.moveEditorState(URI.file('/some/folder'), URI.file('/some/folder-moved'));
memento.moveEditorState(URI.file('/some/folder'), URI.file('/some/folder-moved'), extUri);
res = memento.loadEditorState(testGroup0, URI.file('/some/folder-moved/file-moved.txt'));
assert.equal(res?.line, 1);

View File

@@ -35,8 +35,8 @@ suite('Workbench editor model', () => {
}
});
let input = instantiationService.createInstance(ResourceEditorInput, 'name', 'description', URI.from({ scheme: 'test', authority: null!, path: 'thePath' }), undefined);
let otherInput = instantiationService.createInstance(ResourceEditorInput, 'name2', 'description', URI.from({ scheme: 'test', authority: null!, path: 'thePath' }), undefined);
let input = instantiationService.createInstance(ResourceEditorInput, URI.from({ scheme: 'test', authority: null!, path: 'thePath' }), 'name', 'description', undefined);
let otherInput = instantiationService.createInstance(ResourceEditorInput, URI.from({ scheme: 'test', authority: null!, path: 'thePath' }), 'name2', 'description', undefined);
let diffInput = new DiffEditorInput('name', 'description', input, otherInput);
let model = await diffInput.resolve() as TextDiffEditorModel;

View File

@@ -155,6 +155,7 @@ class TestFileEditorInput extends EditorInput implements IFileEditorInput {
}
getTypeId() { return 'testFileEditorInputForGroups'; }
resolve(): Promise<IEditorModel> { return Promise.resolve(null!); }
setLabel(label: URI): void { }
setEncoding(encoding: string) { }
getEncoding() { return undefined; }
setPreferredEncoding(encoding: string) { }
@@ -276,9 +277,11 @@ suite('Workbench editor groups', () => {
group.openEditor(input1, { pinned: true, active: true });
assert.equal(group.contains(input1), true);
assert.equal(group.contains(input1, true), true);
assert.equal(group.contains(input1, { strictEquals: true }), true);
assert.equal(group.contains(input1, { supportSideBySide: true }), true);
assert.equal(group.contains(input2), false);
assert.equal(group.contains(input2, true), false);
assert.equal(group.contains(input2, { strictEquals: true }), false);
assert.equal(group.contains(input2, { supportSideBySide: true }), false);
assert.equal(group.contains(diffInput1), false);
assert.equal(group.contains(diffInput2), false);
@@ -306,7 +309,7 @@ suite('Workbench editor groups', () => {
group.closeEditor(input1);
assert.equal(group.contains(input1), false);
assert.equal(group.contains(input1, true), true);
assert.equal(group.contains(input1, { supportSideBySide: true }), true);
assert.equal(group.contains(input2), true);
assert.equal(group.contains(diffInput1), true);
assert.equal(group.contains(diffInput2), true);
@@ -314,27 +317,27 @@ suite('Workbench editor groups', () => {
group.closeEditor(input2);
assert.equal(group.contains(input1), false);
assert.equal(group.contains(input1, true), true);
assert.equal(group.contains(input1, { supportSideBySide: true }), true);
assert.equal(group.contains(input2), false);
assert.equal(group.contains(input2, true), true);
assert.equal(group.contains(input2, { supportSideBySide: true }), true);
assert.equal(group.contains(diffInput1), true);
assert.equal(group.contains(diffInput2), true);
group.closeEditor(diffInput1);
assert.equal(group.contains(input1), false);
assert.equal(group.contains(input1, true), true);
assert.equal(group.contains(input1, { supportSideBySide: true }), true);
assert.equal(group.contains(input2), false);
assert.equal(group.contains(input2, true), true);
assert.equal(group.contains(input2, { supportSideBySide: true }), true);
assert.equal(group.contains(diffInput1), false);
assert.equal(group.contains(diffInput2), true);
group.closeEditor(diffInput2);
assert.equal(group.contains(input1), false);
assert.equal(group.contains(input1, true), false);
assert.equal(group.contains(input1, { supportSideBySide: true }), false);
assert.equal(group.contains(input2), false);
assert.equal(group.contains(input2, true), false);
assert.equal(group.contains(input2, { supportSideBySide: true }), false);
assert.equal(group.contains(diffInput1), false);
assert.equal(group.contains(diffInput2), false);

View File

@@ -26,7 +26,7 @@ suite('Resource text editors', () => {
const resource = URI.from({ scheme: 'inmemory', authority: null!, path: 'thePath' });
accessor.modelService.createModel('function test() {}', accessor.modeService.create('text'), resource);
const input: ResourceEditorInput = instantiationService.createInstance(ResourceEditorInput, 'The Name', 'The Description', resource, undefined);
const input: ResourceEditorInput = instantiationService.createInstance(ResourceEditorInput, resource, 'The Name', 'The Description', undefined);
const model = await input.resolve();
@@ -42,7 +42,7 @@ suite('Resource text editors', () => {
const resource = URI.from({ scheme: 'inmemory', authority: null!, path: 'thePath' });
accessor.modelService.createModel('function test() {}', accessor.modeService.create('text'), resource);
const input: ResourceEditorInput = instantiationService.createInstance(ResourceEditorInput, 'The Name', 'The Description', resource, 'resource-input-test');
const input: ResourceEditorInput = instantiationService.createInstance(ResourceEditorInput, resource, 'The Name', 'The Description', 'resource-input-test');
const model = await input.resolve();
assert.ok(model);

View File

@@ -109,9 +109,10 @@ import { IStorageKeysSyncRegistryService, StorageKeysSyncRegistryService } from
import { IPaneComposite } from 'vs/workbench/common/panecomposite';
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
import { UriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentityService';
import { TextFileEditorModelManager } from 'vs/workbench/services/textfile/common/textFileEditorModelManager';
export function createFileEditorInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
return instantiationService.createInstance(FileEditorInput, resource, undefined, undefined);
return instantiationService.createInstance(FileEditorInput, resource, undefined, undefined, undefined);
}
export interface ITestInstantiationService extends IInstantiationService {
@@ -120,7 +121,8 @@ export interface ITestInstantiationService extends IInstantiationService {
export function workbenchInstantiationService(overrides?: {
textFileService?: (instantiationService: IInstantiationService) => ITextFileService
pathService?: (instantiationService: IInstantiationService) => IPathService
pathService?: (instantiationService: IInstantiationService) => IPathService,
editorService?: (instantiationService: IInstantiationService) => IEditorService
}): ITestInstantiationService {
const instantiationService = new TestInstantiationService(new ServiceCollection([ILifecycleService, new TestLifecycleService()]));
@@ -171,7 +173,7 @@ export function workbenchInstantiationService(overrides?: {
const editorGroupService = new TestEditorGroupsService([new TestEditorGroupView(0)]);
instantiationService.stub(IEditorGroupsService, editorGroupService);
instantiationService.stub(ILabelService, <ILabelService>instantiationService.createInstance(LabelService));
const editorService = new TestEditorService(editorGroupService);
const editorService = overrides?.editorService ? overrides.editorService(instantiationService) : new TestEditorService(editorGroupService);
instantiationService.stub(IEditorService, editorService);
instantiationService.stub(ICodeEditorService, new CodeEditorService(editorService, themeService));
instantiationService.stub(IViewletService, new TestViewletService());
@@ -223,7 +225,8 @@ export class TestTextFileService extends BrowserTextFileService {
@ITextModelService textModelService: ITextModelService,
@ICodeEditorService codeEditorService: ICodeEditorService,
@IPathService pathService: IPathService,
@IWorkingCopyFileService workingCopyFileService: IWorkingCopyFileService
@IWorkingCopyFileService workingCopyFileService: IWorkingCopyFileService,
@IUriIdentityService uriIdentityService: IUriIdentityService
) {
super(
fileService,
@@ -239,7 +242,8 @@ export class TestTextFileService extends BrowserTextFileService {
textModelService,
codeEditorService,
pathService,
workingCopyFileService
workingCopyFileService,
uriIdentityService
);
}
@@ -277,7 +281,7 @@ export const TestEnvironmentService = new TestEnvironmentServiceWithArgs(Object.
export class TestProgressService implements IProgressService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
withProgress(
options: IProgressOptions | IProgressWindowOptions | IProgressNotificationOptions | IProgressCompositeOptions,
@@ -290,7 +294,7 @@ export class TestProgressService implements IProgressService {
export class TestAccessibilityService implements IAccessibilityService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
onDidChangeScreenReaderOptimized = Event.None;
@@ -302,7 +306,7 @@ export class TestAccessibilityService implements IAccessibilityService {
export class TestDecorationsService implements IDecorationsService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
onDidChangeDecorations: Event<IResourceDecorationChangeEvent> = Event.None;
@@ -312,7 +316,7 @@ export class TestDecorationsService implements IDecorationsService {
export class TestMenuService implements IMenuService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
createMenu(_id: MenuId, _scopedKeybindingService: IContextKeyService): IMenu {
return {
@@ -325,7 +329,7 @@ export class TestMenuService implements IMenuService {
export class TestHistoryService implements IHistoryService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
constructor(private root?: URI) { }
@@ -346,7 +350,7 @@ export class TestHistoryService implements IHistoryService {
export class TestFileDialogService implements IFileDialogService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
private confirmResult!: ConfirmResult;
@@ -371,7 +375,7 @@ export class TestFileDialogService implements IFileDialogService {
export class TestLayoutService implements IWorkbenchLayoutService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
openedDefaultEditors = false;
@@ -431,7 +435,7 @@ export class TestLayoutService implements IWorkbenchLayoutService {
let activeViewlet: Viewlet = {} as any;
export class TestViewletService implements IViewletService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
onDidViewletRegisterEmitter = new Emitter<ViewletDescriptor>();
onDidViewletDeregisterEmitter = new Emitter<ViewletDescriptor>();
@@ -456,7 +460,7 @@ export class TestViewletService implements IViewletService {
}
export class TestPanelService implements IPanelService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
onDidPanelOpen = new Emitter<{ panel: IPanel, focus: boolean }>().event;
onDidPanelClose = new Emitter<IPanel>().event;
@@ -475,7 +479,7 @@ export class TestPanelService implements IPanelService {
}
export class TestViewsService implements IViewsService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
onDidChangeViewContainerVisibility = new Emitter<{ id: string; visible: boolean; location: ViewContainerLocation }>().event;
@@ -495,7 +499,7 @@ export class TestViewsService implements IViewsService {
export class TestEditorGroupsService implements IEditorGroupsService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
constructor(public groups: TestEditorGroupView[] = []) { }
@@ -626,7 +630,7 @@ export class TestEditorGroupAccessor implements IEditorGroupsAccessor {
export class TestEditorService implements EditorServiceImpl {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
onDidActiveEditorChange: Event<void> = Event.None;
onDidVisibleEditorsChange: Event<void> = Event.None;
@@ -634,10 +638,17 @@ export class TestEditorService implements EditorServiceImpl {
onDidOpenEditorFail: Event<IEditorIdentifier> = Event.None;
onDidMostRecentlyActiveEditorsChange: Event<void> = Event.None;
private _activeTextEditorControl: ICodeEditor | IDiffEditor | undefined;
public get activeTextEditorControl(): ICodeEditor | IDiffEditor | undefined { return this._activeTextEditorControl; }
public set activeTextEditorControl(value: ICodeEditor | IDiffEditor | undefined) { this._activeTextEditorControl = value; }
activeEditorPane: IVisibleEditorPane | undefined;
activeTextEditorControl: ICodeEditor | IDiffEditor | undefined;
activeTextEditorMode: string | undefined;
activeEditor: IEditorInput | undefined;
private _activeEditor: IEditorInput | undefined;
public get activeEditor(): IEditorInput | undefined { return this._activeEditor; }
public set activeEditor(value: IEditorInput | undefined) { this._activeEditor = value; }
editors: ReadonlyArray<IEditorInput> = [];
mostRecentlyActiveEditors: ReadonlyArray<IEditorIdentifier> = [];
visibleEditorPanes: ReadonlyArray<IVisibleEditorPane> = [];
@@ -674,12 +685,12 @@ export class TestEditorService implements EditorServiceImpl {
saveAll(options?: ISaveEditorsOptions): Promise<boolean> { throw new Error('Method not implemented.'); }
revert(editors: IEditorIdentifier[], options?: IRevertOptions): Promise<boolean> { throw new Error('Method not implemented.'); }
revertAll(options?: IRevertAllEditorsOptions): Promise<boolean> { throw new Error('Method not implemented.'); }
whenClosed(resources: URI[], options?: { waitForSaved: boolean }): Promise<void> { throw new Error('Method not implemented.'); }
whenClosed(editors: IResourceEditorInput[], options?: { waitForSaved: boolean }): Promise<void> { throw new Error('Method not implemented.'); }
}
export class TestFileService implements IFileService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
private readonly _onDidFilesChange = new Emitter<FileChangesEvent>();
private readonly _onDidRunOperation = new Emitter<FileOperationEvent>();
@@ -741,7 +752,7 @@ export class TestFileService implements IFileService {
this.lastReadFileUri = resource;
return Promise.resolve({
resource: resource,
resource,
value: {
on: (event: string, callback: Function): void => {
if (event === 'data') {
@@ -751,6 +762,7 @@ export class TestFileService implements IFileService {
callback();
}
},
removeListener: () => { },
resume: () => { },
pause: () => { },
destroy: () => { }
@@ -822,10 +834,14 @@ export class TestFileService implements IFileService {
getWriteEncoding(_resource: URI): IResourceEncoding { return { encoding: 'utf8', hasBOM: false }; }
dispose(): void { }
async canMove(source: URI, target: URI, overwrite?: boolean | undefined): Promise<Error | true> { return true; }
async canCopy(source: URI, target: URI, overwrite?: boolean | undefined): Promise<Error | true> { return true; }
async canDelete(resource: URI, options?: { useTrash?: boolean | undefined; recursive?: boolean | undefined; } | undefined): Promise<Error | true> { return true; }
}
export class TestBackupFileService implements IBackupFileService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
hasBackups(): Promise<boolean> { return Promise.resolve(false); }
hasBackup(_resource: URI): Promise<boolean> { return Promise.resolve(false); }
@@ -847,7 +863,7 @@ export class TestBackupFileService implements IBackupFileService {
export class TestLifecycleService implements ILifecycleService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
phase!: LifecyclePhase;
startupKind!: StartupKind;
@@ -875,7 +891,7 @@ export class TestLifecycleService implements ILifecycleService {
export class TestTextResourceConfigurationService implements ITextResourceConfigurationService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
constructor(private configurationService = new TestConfigurationService()) { }
@@ -932,7 +948,7 @@ export const productService: IProductService = { _serviceBrand: undefined, ...pr
export class TestHostService implements IHostService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
private _hasFocus = true;
get hasFocus() { return this._hasFocus; }
@@ -1057,6 +1073,7 @@ export class TestFileEditorInput extends EditorInput implements IFileEditorInput
getTypeId() { return this.typeId; }
resolve(): Promise<IEditorModel | null> { return !this.fails ? Promise.resolve(null) : Promise.reject(new Error('fails')); }
matches(other: EditorInput): boolean { return !!(other?.resource && this.resource.toString() === other.resource.toString() && other instanceof TestFileEditorInput && other.getTypeId() === this.typeId); }
setLabel(label: URI): void { }
setEncoding(encoding: string) { }
getEncoding() { return undefined; }
setPreferredEncoding(encoding: string) { }
@@ -1094,7 +1111,7 @@ export class TestFileEditorInput extends EditorInput implements IFileEditorInput
this.gotDisposed = true;
}
movedEditor: IMoveResult | undefined = undefined;
move(): IMoveResult | undefined { return this.movedEditor; }
rename(): IMoveResult | undefined { return this.movedEditor; }
}
export class TestEditorPart extends EditorPart {
@@ -1117,7 +1134,7 @@ export class TestEditorPart extends EditorPart {
}
export class TestListService implements IListService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
lastFocusedList: any | undefined = undefined;
@@ -1128,7 +1145,7 @@ export class TestListService implements IListService {
export class TestPathService implements IPathService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
constructor(private readonly fallbackUserHome: URI = URI.from({ scheme: Schemas.vscodeRemote, path: '/' })) { }
@@ -1141,3 +1158,14 @@ export class TestPathService implements IPathService {
return URI.file(path);
}
}
export class TestTextFileEditorModelManager extends TextFileEditorModelManager {
add(resource: URI, model: TextFileEditorModel): void {
return super.add(resource, model);
}
remove(resource: URI): void {
return super.remove(resource);
}
}