Don't use 'as any' when checking open view
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
import { CancellationTokenSource, Uri, ViewColumn, window } from "vscode";
|
import {
|
||||||
|
CancellationTokenSource,
|
||||||
|
TabInputWebview,
|
||||||
|
Uri,
|
||||||
|
ViewColumn,
|
||||||
|
window,
|
||||||
|
} from "vscode";
|
||||||
import {
|
import {
|
||||||
AbstractWebview,
|
AbstractWebview,
|
||||||
WebviewPanelConfig,
|
WebviewPanelConfig,
|
||||||
@@ -151,7 +157,9 @@ export class ModelEditorView extends AbstractWebview<
|
|||||||
private isAModelEditorOpen(): boolean {
|
private isAModelEditorOpen(): boolean {
|
||||||
return window.tabGroups.all.some((tabGroup) =>
|
return window.tabGroups.all.some((tabGroup) =>
|
||||||
tabGroup.tabs.some((tab) => {
|
tabGroup.tabs.some((tab) => {
|
||||||
const viewType: string | undefined = (tab.input as any)?.viewType;
|
const viewType =
|
||||||
|
tab.input instanceof TabInputWebview ? tab.input.viewType : undefined;
|
||||||
|
|
||||||
// The viewType has a prefix, such as "mainThreadWebview-", but if the
|
// The viewType has a prefix, such as "mainThreadWebview-", but if the
|
||||||
// suffix matches that should be enough to identify the view.
|
// suffix matches that should be enough to identify the view.
|
||||||
return viewType && viewType.endsWith("model-editor");
|
return viewType && viewType.endsWith("model-editor");
|
||||||
@@ -162,7 +170,9 @@ export class ModelEditorView extends AbstractWebview<
|
|||||||
private isAModelEditorActive(): boolean {
|
private isAModelEditorActive(): boolean {
|
||||||
return window.tabGroups.all.some((tabGroup) =>
|
return window.tabGroups.all.some((tabGroup) =>
|
||||||
tabGroup.tabs.some((tab) => {
|
tabGroup.tabs.some((tab) => {
|
||||||
const viewType: string | undefined = (tab.input as any)?.viewType;
|
const viewType =
|
||||||
|
tab.input instanceof TabInputWebview ? tab.input.viewType : undefined;
|
||||||
|
|
||||||
// The viewType has a prefix, such as "mainThreadWebview-", but if the
|
// The viewType has a prefix, such as "mainThreadWebview-", but if the
|
||||||
// suffix matches that should be enough to identify the view.
|
// suffix matches that should be enough to identify the view.
|
||||||
return viewType && viewType.endsWith("model-editor") && tab.isActive;
|
return viewType && viewType.endsWith("model-editor") && tab.isActive;
|
||||||
|
|||||||
Reference in New Issue
Block a user