Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { ModelUndoRedoParticipant } from 'vs/editor/common/services/modelUndoRedoParticipant';
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';

class ResourceModelCollection extends ReferenceCollection<Promise<ITextEditorModel>> {

Expand Down Expand Up @@ -174,13 +175,20 @@ export class TextModelResolverService extends Disposable implements ITextModelSe
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IFileService private readonly fileService: IFileService,
@IUndoRedoService private readonly undoRedoService: IUndoRedoService,
@IModelService private readonly modelService: IModelService
@IModelService private readonly modelService: IModelService,
@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,
) {
super();
this._register(new ModelUndoRedoParticipant(this.modelService, this, this.undoRedoService));
}

async createModelReference(resource: URI): Promise<IReference<IResolvedTextEditorModel>> {

// From this moment on, only operate on the canonical resource
// to ensure we reduce the chance of resolving the same resource
// with different resource forms (e.g. path casing on Windows)
resource = this.uriIdentityService.asCanonicalUri(resource);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bpasero this is the brute force way which might be OK... However, there are still all callers that we might need to visit and should maybe move this call to where it matter most, e.g where we actually branch off into the file service. E.g here:

return this.textFileService.files.resolve(resource, { reason: TextFileLoadReason.REFERENCE });

All other places shouldn't be affected by URI "normalization" because only file systems can contribute rules.

Comment thread
jrieken marked this conversation as resolved.

const ref = this.resourceModelCollection.acquire(resource.toString());

try {
Expand Down