Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 (#8911)

* Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2

* update distro

* fix layering

* update distro

* fix tests
This commit is contained in:
Anthony Dresser
2020-01-22 13:42:37 -08:00
committed by GitHub
parent 977111eb21
commit bd7aac8ee0
895 changed files with 24651 additions and 14520 deletions

View File

@@ -38,7 +38,7 @@ class ResourceModelCollection extends ReferenceCollection<Promise<ITextEditorMod
// File or remote file provider already known
if (this.fileService.canHandleResource(resource)) {
return this.textFileService.models.loadOrCreate(resource, { reason: LoadReason.REFERENCE });
return this.textFileService.files.resolve(resource, { reason: LoadReason.REFERENCE });
}
// Virtual documents
@@ -64,7 +64,7 @@ class ResourceModelCollection extends ReferenceCollection<Promise<ITextEditorMod
modelPromise.then(model => {
if (this.modelsToDispose.has(key)) {
if (model instanceof TextFileEditorModel) {
this.textFileService.models.disposeModel(model);
this.textFileService.files.disposeModel(model);
} else {
model.dispose();
}
@@ -141,9 +141,9 @@ export class TextModelResolverService implements ITextModelService {
// Untitled Schema: go through cached input
if (resource.scheme === network.Schemas.untitled) {
const model = await this.untitledTextEditorService.loadOrCreate({ resource });
const model = await this.untitledTextEditorService.resolve({ untitledResource: resource });
return new ImmortalReference(model as IResolvedTextEditorModel);
return new ImmortalReference(model);
}
// InMemory Schema: go through model service cache
@@ -175,6 +175,10 @@ export class TextModelResolverService implements ITextModelService {
}
hasTextModelContentProvider(scheme: string): boolean {
if (scheme === network.Schemas.untitled || scheme === network.Schemas.inMemory) {
return true; // we handle untitled:// and inMemory:// within
}
return this.resourceModelCollection.hasTextModelContentProvider(scheme);
}
}

View File

@@ -48,9 +48,7 @@ suite('Workbench - TextModelResolverService', () => {
model.dispose();
model = (undefined)!;
}
(<TextFileEditorModelManager>accessor.textFileService.models).clear();
(<TextFileEditorModelManager>accessor.textFileService.models).dispose();
accessor.untitledTextEditorService.revertAll();
(<TextFileEditorModelManager>accessor.textFileService.files).dispose();
});
test('resolve resource', async () => {
@@ -88,7 +86,7 @@ suite('Workbench - TextModelResolverService', () => {
test('resolve file', async function () {
const textModel = instantiationService.createInstance(TextFileEditorModel, toResource.call(this, '/path/file_resolver.txt'), 'utf8', undefined);
(<TextFileEditorModelManager>accessor.textFileService.models).add(textModel.resource, textModel);
(<TextFileEditorModelManager>accessor.textFileService.files).add(textModel.resource, textModel);
await textModel.load();
@@ -112,7 +110,7 @@ suite('Workbench - TextModelResolverService', () => {
test('resolve untitled', async () => {
const service = accessor.untitledTextEditorService;
const input = service.createOrGet();
const input = service.create();
await input.resolve();
const ref = await accessor.textModelResolverService.createModelReference(input.getResource());
@@ -121,6 +119,7 @@ suite('Workbench - TextModelResolverService', () => {
assert.ok(editorModel);
ref.dispose();
input.dispose();
model.dispose();
});
test('even loading documents should be refcounted', async () => {