diff --git a/src/vs/workbench/api/common/extHostCodeInsets.ts b/src/vs/workbench/api/common/extHostCodeInsets.ts index 64650ee5ccf..7902345e471 100644 --- a/src/vs/workbench/api/common/extHostCodeInsets.ts +++ b/src/vs/workbench/api/common/extHostCodeInsets.ts @@ -12,7 +12,6 @@ import type * as vscode from 'vscode'; import { ExtHostEditorInsetsShape, MainThreadEditorInsetsShape } from './extHost.protocol'; import { asWebviewUri, webviewGenericCspSource, WebviewInitData } from 'vs/workbench/api/common/shared/webview'; import { generateUuid } from 'vs/base/common/uuid'; -import { Schemas } from 'vs/base/common/network'; export class ExtHostEditorInsets implements ExtHostEditorInsetsShape { @@ -67,7 +66,7 @@ export class ExtHostEditorInsets implements ExtHostEditorInsetsShape { private _options: vscode.WebviewOptions = Object.create(null); asWebviewUri(resource: vscode.Uri): vscode.Uri { - const remoteAuthority = extension.extensionLocation.scheme === Schemas.vscodeRemote + const remoteAuthority = that._initData.remote.isRemote ? that._initData.remote.authority : undefined; return asWebviewUri(this._uuid, resource, remoteAuthority); diff --git a/src/vs/workbench/api/common/extHostNotebookKernels.ts b/src/vs/workbench/api/common/extHostNotebookKernels.ts index 322707160f4..b57dc5f73a0 100644 --- a/src/vs/workbench/api/common/extHostNotebookKernels.ts +++ b/src/vs/workbench/api/common/extHostNotebookKernels.ts @@ -20,7 +20,6 @@ import { CellEditType, IImmediateCellEditOperation, NotebookCellExecutionState, import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { asArray } from 'vs/base/common/arrays'; import { ILogService } from 'vs/platform/log/common/log'; -import { Schemas } from 'vs/base/common/network'; interface IKernelData { extensionId: ExtensionIdentifier, @@ -191,7 +190,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape { return that._proxy.$postMessage(handle, editor && that._extHostNotebook.getIdByEditor(editor), message); }, asWebviewUri(uri: URI) { - const remoteAuthority = extension.extensionLocation.scheme === Schemas.vscodeRemote + const remoteAuthority = that._initData.remote.isRemote ? that._initData.remote.authority : undefined; return asWebviewUri(String(handle), uri, remoteAuthority); diff --git a/src/vs/workbench/api/common/extHostWebview.ts b/src/vs/workbench/api/common/extHostWebview.ts index ce4ce39d8cb..f3845612563 100644 --- a/src/vs/workbench/api/common/extHostWebview.ts +++ b/src/vs/workbench/api/common/extHostWebview.ts @@ -5,7 +5,6 @@ import { VSBuffer } from 'vs/base/common/buffer'; import { Emitter, Event } from 'vs/base/common/event'; -import { Schemas } from 'vs/base/common/network'; import { URI } from 'vs/base/common/uri'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { normalizeVersion, parseVersion } from 'vs/platform/extensions/common/extensionValidator'; @@ -70,7 +69,7 @@ export class ExtHostWebview implements vscode.Webview { public asWebviewUri(resource: vscode.Uri): vscode.Uri { this.#hasCalledAsWebviewUri = true; - const remoteAuthority = this.#extension.extensionLocation.scheme === Schemas.vscodeRemote + const remoteAuthority = this.#initData.remote.isRemote ? this.#initData.remote.authority : undefined; return asWebviewUri(this.#handle, resource, remoteAuthority); diff --git a/src/vs/workbench/api/common/shared/webview.ts b/src/vs/workbench/api/common/shared/webview.ts index 13ec3d02943..2d26fd0ca52 100644 --- a/src/vs/workbench/api/common/shared/webview.ts +++ b/src/vs/workbench/api/common/shared/webview.ts @@ -8,7 +8,10 @@ import { URI } from 'vs/base/common/uri'; import type * as vscode from 'vscode'; export interface WebviewInitData { - readonly remote: { readonly authority: string | undefined }; + readonly remote: { + readonly isRemote: boolean; + readonly authority: string | undefined + }; } /** diff --git a/src/vs/workbench/test/browser/api/extHostWebview.test.ts b/src/vs/workbench/test/browser/api/extHostWebview.test.ts index bbdee0feefd..4dd59f11662 100644 --- a/src/vs/workbench/test/browser/api/extHostWebview.test.ts +++ b/src/vs/workbench/test/browser/api/extHostWebview.test.ts @@ -31,7 +31,7 @@ suite('ExtHostWebview', () => { test('Cannot register multiple serializers for the same view type', async () => { const viewType = 'view.type'; - const extHostWebviews = new ExtHostWebviews(rpcProtocol!, { remote: { authority: undefined } }, undefined, new NullLogService(), NullApiDeprecationService); + const extHostWebviews = new ExtHostWebviews(rpcProtocol!, { remote: { authority: undefined, isRemote: false } }, undefined, new NullLogService(), NullApiDeprecationService); const extHostWebviewPanels = new ExtHostWebviewPanels(rpcProtocol!, extHostWebviews, undefined); @@ -123,7 +123,8 @@ suite('ExtHostWebview', () => { function createWebview(rpcProtocol: (IExtHostRpcService & IExtHostContext) | undefined, remoteAuthority: string | undefined) { const extHostWebviews = new ExtHostWebviews(rpcProtocol!, { remote: { - authority: remoteAuthority + authority: remoteAuthority, + isRemote: !!remoteAuthority, }, }, undefined, new NullLogService(), NullApiDeprecationService);