@@ -94,7 +94,7 @@ export class WebviewController<
9494 container : Container ,
9595 commandRegistrar : WebviewCommandRegistrar ,
9696 descriptor : WebviewPanelDescriptor < ID > ,
97- instanceId : string | undefined ,
97+ instanceId : string ,
9898 parent : WebviewPanel ,
9999 resolveProvider : (
100100 container : Container ,
@@ -110,7 +110,7 @@ export class WebviewController<
110110 container : Container ,
111111 commandRegistrar : WebviewCommandRegistrar ,
112112 descriptor : WebviewViewDescriptor < ID > ,
113- instanceId : string | undefined ,
113+ instanceId : string ,
114114 parent : WebviewView ,
115115 resolveProvider : (
116116 container : Container ,
@@ -126,7 +126,7 @@ export class WebviewController<
126126 container : Container ,
127127 commandRegistrar : WebviewCommandRegistrar ,
128128 descriptor : GetWebviewDescriptor < ID > ,
129- instanceId : string | undefined ,
129+ instanceId : string ,
130130 parent : GetWebviewParent < ID > ,
131131 resolveProvider : (
132132 container : Container ,
@@ -173,7 +173,7 @@ export class WebviewController<
173173 private readonly container : Container ,
174174 private readonly _commandRegistrar : WebviewCommandRegistrar ,
175175 private readonly descriptor : GetWebviewDescriptor < ID > ,
176- public readonly instanceId : string | undefined ,
176+ public readonly instanceId : string ,
177177 public readonly parent : GetWebviewParent < ID > ,
178178 resolveProvider : (
179179 container : Container ,
@@ -240,7 +240,14 @@ export class WebviewController<
240240 command : WebviewCommands | WebviewViewCommands ,
241241 callback : WebviewCommandCallback < T > ,
242242 ) : Disposable {
243- return this . _commandRegistrar . registerCommand ( this . provider , this . id , this . instanceId , command , callback ) ;
243+ return this . _commandRegistrar . registerCommand (
244+ this . provider ,
245+ this . id ,
246+ // We should be able to remove this in the future and always use the instanceId, but we need to do more testing to make sure each webview command always comes with the instanceId
247+ this . descriptor . allowMultipleInstances ? this . instanceId : undefined ,
248+ command ,
249+ callback ,
250+ ) ;
244251 }
245252
246253 private _initializing : Promise < void > | undefined ;
0 commit comments