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

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);
}
}