1- import { CancellationTokenSource , Uri , ViewColumn , window } from "vscode" ;
1+ import {
2+ CancellationTokenSource ,
3+ TabInputWebview ,
4+ Uri ,
5+ ViewColumn ,
6+ window ,
7+ } from "vscode" ;
28import {
39 AbstractWebview ,
410 WebviewPanelConfig ,
@@ -151,7 +157,9 @@ export class ModelEditorView extends AbstractWebview<
151157 private isAModelEditorOpen ( ) : boolean {
152158 return window . tabGroups . all . some ( ( tabGroup ) =>
153159 tabGroup . tabs . some ( ( tab ) => {
154- const viewType : string | undefined = ( tab . input as any ) ?. viewType ;
160+ const viewType =
161+ tab . input instanceof TabInputWebview ? tab . input . viewType : undefined ;
162+
155163 // The viewType has a prefix, such as "mainThreadWebview-", but if the
156164 // suffix matches that should be enough to identify the view.
157165 return viewType && viewType . endsWith ( "model-editor" ) ;
@@ -162,7 +170,9 @@ export class ModelEditorView extends AbstractWebview<
162170 private isAModelEditorActive ( ) : boolean {
163171 return window . tabGroups . all . some ( ( tabGroup ) =>
164172 tabGroup . tabs . some ( ( tab ) => {
165- const viewType : string | undefined = ( tab . input as any ) ?. viewType ;
173+ const viewType =
174+ tab . input instanceof TabInputWebview ? tab . input . viewType : undefined ;
175+
166176 // The viewType has a prefix, such as "mainThreadWebview-", but if the
167177 // suffix matches that should be enough to identify the view.
168178 return viewType && viewType . endsWith ( "model-editor" ) && tab . isActive ;
0 commit comments