From 68cb05528957f98072b791dfe23d55bcc95b8ab7 Mon Sep 17 00:00:00 2001 From: Vladimir Piskarev Date: Mon, 29 Apr 2024 17:28:17 +0300 Subject: [PATCH] Fix incorrect URI conversions in `custom-editors-main.ts` (#13653) --- .../browser/custom-editors/custom-editors-main.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/plugin-ext/src/main/browser/custom-editors/custom-editors-main.ts b/packages/plugin-ext/src/main/browser/custom-editors/custom-editors-main.ts index 51dca8780740a..a7951da9167ca 100644 --- a/packages/plugin-ext/src/main/browser/custom-editors/custom-editors-main.ts +++ b/packages/plugin-ext/src/main/browser/custom-editors/custom-editors-main.ts @@ -139,14 +139,14 @@ export class CustomEditorsMainImpl implements CustomEditorsMain, Disposable { widget.onMove(async (newResource: TheiaURI) => { const oldModel = modelRef; modelRef = await this.getOrCreateCustomEditorModel(modelType, newResource, viewType, onMoveCancelTokenSource.token); - this.proxy.$onMoveCustomEditor(identifier.id, URI.file(newResource.path.toString()), viewType); + this.proxy.$onMoveCustomEditor(identifier.id, newResource.toComponents(), viewType); oldModel.dispose(); }); } const _cancellationSource = new CancellationTokenSource(); await this.proxy.$resolveWebviewEditor( - URI.file(resource.path.toString()), + resource.toComponents(), identifier.id, viewType, this.labelProvider.getName(resource)!, @@ -309,7 +309,7 @@ export class MainCustomEditorModel implements CustomEditorModel { editorPreferences: EditorPreferences, cancellation: CancellationToken, ): Promise { - const { editable } = await proxy.$createCustomDocument(URI.file(resource.path.toString()), viewType, {}, cancellation); + const { editable } = await proxy.$createCustomDocument(resource.toComponents(), viewType, {}, cancellation); return new MainCustomEditorModel(proxy, viewType, resource, editable, undoRedoService, fileService, editorPreferences); } @@ -339,7 +339,7 @@ export class MainCustomEditorModel implements CustomEditorModel { } get resource(): URI { - return URI.file(this.editorResource.path.toString()); + return URI.from(this.editorResource.toComponents()); } get dirty(): boolean { @@ -441,7 +441,7 @@ export class MainCustomEditorModel implements CustomEditorModel { async saveCustomEditorAs(resource: TheiaURI, targetResource: TheiaURI, options?: SaveOptions): Promise { if (this.editable) { const source = new CancellationTokenSource(); - await this.proxy.$onSaveAs(this.resource, this.viewType, URI.file(targetResource.path.toString()), source.token); + await this.proxy.$onSaveAs(this.resource, this.viewType, targetResource.toComponents(), source.token); this.change(() => { this.savePoint = this.currentEditIndex; }); @@ -561,7 +561,7 @@ export class CustomTextEditorModel implements CustomEditorModel { } get resource(): URI { - return URI.file(this.editorResource.path.toString()); + return URI.from(this.editorResource.toComponents()); } get dirty(): boolean {