Skip to content

Commit 829a336

Browse files
authored
Merge pull request microsoft#252071 from jeanp413/fix-251473
Fix "Assertion Failed: Argument is undefined or null" when renaming custom editor
2 parents 78a1609 + 750a0ad commit 829a336

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

src/vs/workbench/api/browser/mainThreadCustomEditors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ export class MainThreadCustomEditors extends Disposable implements extHostProtoc
201201
}
202202

203203
try {
204-
await this._proxyCustomEditors.$resolveCustomEditor(this._uriIdentityService.asCanonicalUri(resource), handle, viewType, {
204+
const actualResource = modelType === CustomEditorModelType.Text ? this._uriIdentityService.asCanonicalUri(resource) : resource;
205+
await this._proxyCustomEditors.$resolveCustomEditor(actualResource, handle, viewType, {
205206
title: webviewInput.getTitle(),
206207
contentOptions: webviewInput.webview.contentOptions,
207208
options: webviewInput.webview.options,

src/vs/workbench/contrib/customEditor/browser/customEditors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
5555
) {
5656
super();
5757

58-
this._models = new CustomEditorModelManager(this.uriIdentityService);
58+
this._models = new CustomEditorModelManager();
5959

6060
this._contributedEditors = this._register(new ContributedCustomEditors(storageService));
6161
// Register the contribution points only emitting one change from the resolver

src/vs/workbench/contrib/customEditor/common/customEditorModelManager.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,9 @@
66
import { createSingleCallFunction } from '../../../../base/common/functional.js';
77
import { IReference } from '../../../../base/common/lifecycle.js';
88
import { URI } from '../../../../base/common/uri.js';
9-
import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js';
109
import { ICustomEditorModel, ICustomEditorModelManager } from './customEditor.js';
1110

1211
export class CustomEditorModelManager implements ICustomEditorModelManager {
13-
private readonly _uriIdentityService: IUriIdentityService;
14-
15-
constructor(
16-
uriIdentityService: IUriIdentityService,
17-
) {
18-
this._uriIdentityService = uriIdentityService;
19-
}
2012

2113
private readonly _references = new Map<string, {
2214
readonly viewType: string;
@@ -84,7 +76,6 @@ export class CustomEditorModelManager implements ICustomEditorModelManager {
8476
}
8577

8678
private key(resource: URI, viewType: string): string {
87-
resource = this._uriIdentityService.asCanonicalUri(resource);
8879
return `${resource.toString()}@@@${viewType}`;
8980
}
9081
}

0 commit comments

Comments
 (0)