mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 01:25:36 -05:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -13,10 +13,11 @@ import { IDisposable, toDisposable, IReference, ReferenceCollection, ImmortalRef
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import network = require('vs/base/common/network');
|
||||
import * as network from 'vs/base/common/network';
|
||||
import { ITextModelService, ITextModelContentProvider, ITextEditorModel } from 'vs/editor/common/services/resolverService';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
|
||||
class ResourceModelCollection extends ReferenceCollection<TPromise<ITextEditorModel>> {
|
||||
|
||||
@@ -24,19 +25,15 @@ class ResourceModelCollection extends ReferenceCollection<TPromise<ITextEditorMo
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@ITextFileService private textFileService: ITextFileService
|
||||
@ITextFileService private textFileService: ITextFileService,
|
||||
@IFileService private fileService: IFileService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
public createReferencedObject(key: string): TPromise<ITextEditorModel> {
|
||||
const resource = URI.parse(key);
|
||||
|
||||
if (resource.scheme === network.Schemas.file) {
|
||||
return this.textFileService.models.loadOrCreate(resource);
|
||||
}
|
||||
if (!this.providers[resource.scheme]) {
|
||||
// TODO@remote
|
||||
if (this.fileService.canHandleResource(resource)) {
|
||||
return this.textFileService.models.loadOrCreate(resource);
|
||||
}
|
||||
return this.resolveTextModelContent(key).then(() => this.instantiationService.createInstance(ResourceEditorModel, resource));
|
||||
|
||||
@@ -56,7 +56,7 @@ suite('Workbench - TextModelResolverService', () => {
|
||||
accessor.untitledEditorService.revertAll();
|
||||
});
|
||||
|
||||
test('resolve resource', function (done) {
|
||||
test('resolve resource', function () {
|
||||
const dispose = accessor.textModelResolverService.registerTextModelContentProvider('test', {
|
||||
provideTextContent: function (resource: URI): TPromise<ITextModel> {
|
||||
if (resource.scheme === 'test') {
|
||||
@@ -72,7 +72,7 @@ suite('Workbench - TextModelResolverService', () => {
|
||||
let resource = URI.from({ scheme: 'test', authority: null, path: 'thePath' });
|
||||
let input: ResourceEditorInput = instantiationService.createInstance(ResourceEditorInput, 'The Name', 'The Description', resource);
|
||||
|
||||
input.resolve().then(model => {
|
||||
return input.resolve().then(model => {
|
||||
assert.ok(model);
|
||||
assert.equal(snapshotToString((model as ResourceEditorModel).createSnapshot()), 'Hello Test');
|
||||
|
||||
@@ -85,7 +85,6 @@ suite('Workbench - TextModelResolverService', () => {
|
||||
assert.equal(disposed, true);
|
||||
|
||||
dispose.dispose();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user