From 9146bf8220d9fd809a84f471cbbfcdd463fdbf34 Mon Sep 17 00:00:00 2001 From: Dayoung Lee Date: Wed, 1 Nov 2023 18:49:03 +0900 Subject: [PATCH 1/2] [EdgeTPU] Bind EdgeTPUCfg node visibility to Backend This commit shows edgetpucfg node only if EdgeTPU Backend is registered. ONE-vscode-DCO-1.0-Signed-off-by: Dayoung Lee --- src/OneExplorer/OneExplorer.ts | 13 ++++--------- src/OneExplorer/OneStorage.ts | 5 ++++- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/OneExplorer/OneExplorer.ts b/src/OneExplorer/OneExplorer.ts index 082ee109..27371952 100644 --- a/src/OneExplorer/OneExplorer.ts +++ b/src/OneExplorer/OneExplorer.ts @@ -214,15 +214,10 @@ class NodeFactory { "Config nodes cannot have attributes" ); const ext = path.extname(fpath); - switch (ext) { - case ".edgetpucfg": { - node = new ConfigNode(uri, parent, "one.editor.edgetpucfg"); - break; - } - case ".cfg": - default: { - node = new ConfigNode(uri, parent); - } + if (BackendContext.isRegistered("EdgeTPU") && ext === ".edgetpucfg") { + node = new ConfigNode(uri, parent, "one.editor.edgetpucfg"); + } else { + node = new ConfigNode(uri, parent); } break; } diff --git a/src/OneExplorer/OneStorage.ts b/src/OneExplorer/OneStorage.ts index 1e2b5b8d..e5c1eeb8 100644 --- a/src/OneExplorer/OneStorage.ts +++ b/src/OneExplorer/OneStorage.ts @@ -24,6 +24,7 @@ import { Logger } from "../Utils/Logger"; import { ConfigObj } from "./ConfigObject"; import { Node, NodeType } from "./OneExplorer"; +import { BackendContext } from "../Backend/API"; export { CfgToCfgObjMap as _unit_test_CfgToCfgObjMap }; @@ -208,7 +209,9 @@ export class OneStorage { }; try { - const extList = [".cfg", ".edgetpucfg"]; + const extList = BackendContext.isRegistered("EdgeTPU") + ? [".cfg", ".edgetpucfg"] + : [".cfg"]; return roots .map((root) => From 8f64f2c3978796606e487101433714459357e003 Mon Sep 17 00:00:00 2001 From: Dayoung Lee Date: Fri, 3 Nov 2023 13:48:26 +0900 Subject: [PATCH 2/2] Fix ONE-vscode-DCO-1.0-Signed-off-by: Dayoung Lee --- src/OneExplorer/OneExplorer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OneExplorer/OneExplorer.ts b/src/OneExplorer/OneExplorer.ts index 27371952..72761e39 100644 --- a/src/OneExplorer/OneExplorer.ts +++ b/src/OneExplorer/OneExplorer.ts @@ -22,6 +22,7 @@ import * as vscode from "vscode"; import { obtainWorkspaceRoots } from "../Utils/Helpers"; import { Logger } from "../Utils/Logger"; +import { BackendContext } from "../Backend/API"; import { ConfigObj } from "./ConfigObject"; import { ArtifactAttr } from "./ArtifactLocator"; import { OneStorage } from "./OneStorage";