mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode e74405d11443c5361c31e2bc341866d146eee206 (#8740)
This commit is contained in:
@@ -256,17 +256,17 @@ suite('Workbench base editor', () => {
|
||||
}
|
||||
|
||||
class TestEditorInput extends EditorInput {
|
||||
constructor(private resource: URI, private id = 'testEditorInput') {
|
||||
constructor(private resource: URI, private id = 'testEditorInputForMementoTest') {
|
||||
super();
|
||||
}
|
||||
public getTypeId() { return 'testEditorInput'; }
|
||||
public resolve(): Promise<IEditorModel> { return Promise.resolve(null!); }
|
||||
getTypeId() { return 'testEditorInputForMementoTest'; }
|
||||
resolve(): Promise<IEditorModel> { return Promise.resolve(null!); }
|
||||
|
||||
public matches(other: TestEditorInput): boolean {
|
||||
matches(other: TestEditorInput): boolean {
|
||||
return other && this.id === other.id && other instanceof TestEditorInput;
|
||||
}
|
||||
|
||||
public getResource(): URI {
|
||||
getResource(): URI {
|
||||
return this.resource;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
|
||||
import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService';
|
||||
import sinon = require('sinon');
|
||||
|
||||
const container = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer('test', ViewContainerLocation.Sidebar);
|
||||
const container = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({ id: 'test', name: 'test' }, ViewContainerLocation.Sidebar);
|
||||
const ViewsRegistry = Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry);
|
||||
|
||||
class ViewDescriptorSequence {
|
||||
|
||||
@@ -11,7 +11,8 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenAction, QuickOpenHandler } from 'vs/workbench/browser/quickopen';
|
||||
|
||||
export class TestQuickOpenService implements IQuickOpenService {
|
||||
public _serviceBrand: undefined;
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private callback?: (prefix?: string) => void;
|
||||
|
||||
@@ -44,8 +45,8 @@ export class TestQuickOpenService implements IQuickOpenService {
|
||||
return null!;
|
||||
}
|
||||
|
||||
public dispose() { }
|
||||
public navigate(): void { }
|
||||
dispose() { }
|
||||
navigate(): void { }
|
||||
}
|
||||
|
||||
suite('QuickOpen', () => {
|
||||
|
||||
@@ -16,7 +16,7 @@ suite('Viewlets', () => {
|
||||
super('id', null!, null!, null!, null!, null!, null!, null!, null!, null!, null!);
|
||||
}
|
||||
|
||||
public layout(dimension: any): void {
|
||||
layout(dimension: any): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import { TestTextResourcePropertiesService } from 'vs/workbench/test/workbenchTe
|
||||
|
||||
class MyEditorModel extends EditorModel { }
|
||||
class MyTextEditorModel extends BaseTextEditorModel {
|
||||
public createTextEditorModel(value: ITextBufferFactory, resource?: URI, preferredMode?: string) {
|
||||
createTextEditorModel(value: ITextBufferFactory, resource?: URI, preferredMode?: string) {
|
||||
return super.createTextEditorModel(value, resource, preferredMode);
|
||||
}
|
||||
|
||||
|
||||
@@ -245,26 +245,25 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
this.resolveTextContentError = error;
|
||||
}
|
||||
|
||||
readStream(resource: URI, options?: IReadTextFileOptions): Promise<ITextFileStreamContent> {
|
||||
async readStream(resource: URI, options?: IReadTextFileOptions): Promise<ITextFileStreamContent> {
|
||||
if (this.resolveTextContentError) {
|
||||
const error = this.resolveTextContentError;
|
||||
this.resolveTextContentError = null;
|
||||
|
||||
return Promise.reject(error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
return this.fileService.readFileStream(resource, options).then(async (content): Promise<ITextFileStreamContent> => {
|
||||
return {
|
||||
resource: content.resource,
|
||||
name: content.name,
|
||||
mtime: content.mtime,
|
||||
ctime: content.ctime,
|
||||
etag: content.etag,
|
||||
encoding: 'utf8',
|
||||
value: await createTextBufferFactoryFromStream(content.value),
|
||||
size: 10
|
||||
};
|
||||
});
|
||||
const content = await this.fileService.readFileStream(resource, options);
|
||||
return {
|
||||
resource: content.resource,
|
||||
name: content.name,
|
||||
mtime: content.mtime,
|
||||
ctime: content.ctime,
|
||||
etag: content.etag,
|
||||
encoding: 'utf8',
|
||||
value: await createTextBufferFactoryFromStream(content.value),
|
||||
size: 10
|
||||
};
|
||||
}
|
||||
|
||||
promptForPath(_resource: URI, _defaultPath: URI): Promise<URI> {
|
||||
@@ -690,6 +689,7 @@ export class TestEditorGroupsService implements IEditorGroupsService {
|
||||
onDidMoveGroup: Event<IEditorGroup> = Event.None;
|
||||
onDidGroupIndexChange: Event<IEditorGroup> = Event.None;
|
||||
onDidLayout: Event<IDimension> = Event.None;
|
||||
onDidEditorPartOptionsChange = Event.None;
|
||||
|
||||
orientation: any;
|
||||
whenRestored: Promise<void> = Promise.resolve(undefined);
|
||||
@@ -967,6 +967,7 @@ export class TestFileService implements IFileService {
|
||||
private readonly _onAfterOperation: Emitter<FileOperationEvent>;
|
||||
|
||||
readonly onWillActivateFileSystemProvider = Event.None;
|
||||
readonly onDidChangeFileSystemProviderCapabilities = Event.None;
|
||||
readonly onError: Event<Error> = Event.None;
|
||||
|
||||
private content = 'Hello Html';
|
||||
@@ -1021,12 +1022,14 @@ export class TestFileService implements IFileService {
|
||||
});
|
||||
}
|
||||
|
||||
resolveAll(toResolve: { resource: URI, options?: IResolveFileOptions }[]): Promise<IResolveFileResult[]> {
|
||||
return Promise.all(toResolve.map(resourceAndOption => this.resolve(resourceAndOption.resource, resourceAndOption.options))).then(stats => stats.map(stat => ({ stat, success: true })));
|
||||
async resolveAll(toResolve: { resource: URI, options?: IResolveFileOptions }[]): Promise<IResolveFileResult[]> {
|
||||
const stats = await Promise.all(toResolve.map(resourceAndOption => this.resolve(resourceAndOption.resource, resourceAndOption.options)));
|
||||
|
||||
return stats.map(stat => ({ stat, success: true }));
|
||||
}
|
||||
|
||||
exists(_resource: URI): Promise<boolean> {
|
||||
return Promise.resolve(true);
|
||||
async exists(_resource: URI): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
readFile(resource: URI, options?: IReadFileOptions | undefined): Promise<IFileContent> {
|
||||
@@ -1071,11 +1074,12 @@ export class TestFileService implements IFileService {
|
||||
});
|
||||
}
|
||||
|
||||
writeFile(resource: URI, bufferOrReadable: VSBuffer | VSBufferReadable, options?: IWriteFileOptions): Promise<IFileStatWithMetadata> {
|
||||
return timeout(0).then(() => ({
|
||||
async writeFile(resource: URI, bufferOrReadable: VSBuffer | VSBufferReadable, options?: IWriteFileOptions): Promise<IFileStatWithMetadata> {
|
||||
await timeout(0);
|
||||
|
||||
return ({
|
||||
resource,
|
||||
etag: 'index.txt',
|
||||
encoding: 'utf8',
|
||||
mtime: Date.now(),
|
||||
ctime: Date.now(),
|
||||
size: 42,
|
||||
@@ -1083,7 +1087,7 @@ export class TestFileService implements IFileService {
|
||||
isDirectory: false,
|
||||
isSymbolicLink: false,
|
||||
name: resources.basename(resource)
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
move(_source: URI, _target: URI, _overwrite?: boolean): Promise<IFileStatWithMetadata> {
|
||||
@@ -1120,7 +1124,13 @@ export class TestFileService implements IFileService {
|
||||
return resource.scheme === 'file' || this.providers.has(resource.scheme);
|
||||
}
|
||||
|
||||
hasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean { return false; }
|
||||
hasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean {
|
||||
if (capability === FileSystemProviderCapabilities.PathCaseSensitive && isLinux) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
del(_resource: URI, _options?: { useTrash?: boolean, recursive?: boolean }): Promise<void> {
|
||||
return Promise.resolve();
|
||||
@@ -1153,14 +1163,13 @@ export class TestBackupFileService implements IBackupFileService {
|
||||
return false;
|
||||
}
|
||||
|
||||
loadBackupResource(resource: URI): Promise<URI | undefined> {
|
||||
return this.hasBackup(resource).then(hasBackup => {
|
||||
if (hasBackup) {
|
||||
return this.toBackupResource(resource);
|
||||
}
|
||||
async loadBackupResource(resource: URI): Promise<URI | undefined> {
|
||||
const hasBackup = await this.hasBackup(resource);
|
||||
if (hasBackup) {
|
||||
return this.toBackupResource(resource);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
});
|
||||
return undefined;
|
||||
}
|
||||
|
||||
registerResourceForBackup(_resource: URI): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user