Skip to content

Commit

Permalink
[EdgeTPU] Bind EdgeTPUCfg node visibility to Backend
Browse files Browse the repository at this point in the history
This commit shows edgetpucfg node only if EdgeTPU Backend is registered.

ONE-vscode-DCO-1.0-Signed-off-by: Dayoung Lee <[email protected]>
  • Loading branch information
dayo09 committed Nov 3, 2023
1 parent d31235b commit 9146bf8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
13 changes: 4 additions & 9 deletions src/OneExplorer/OneExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {

Check failure on line 217 in src/OneExplorer/OneExplorer.ts

View workflow job for this annotation

GitHub Actions / check-test

Cannot find name 'BackendContext'.

Check failure on line 217 in src/OneExplorer/OneExplorer.ts

View workflow job for this annotation

GitHub Actions / check-compile

Cannot find name 'BackendContext'.
node = new ConfigNode(uri, parent, "one.editor.edgetpucfg");
} else {
node = new ConfigNode(uri, parent);
}
break;
}
Expand Down
5 changes: 4 additions & 1 deletion src/OneExplorer/OneStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down Expand Up @@ -208,7 +209,9 @@ export class OneStorage {
};

try {
const extList = [".cfg", ".edgetpucfg"];
const extList = BackendContext.isRegistered("EdgeTPU")
? [".cfg", ".edgetpucfg"]
: [".cfg"];

return roots
.map((root) =>
Expand Down

0 comments on commit 9146bf8

Please sign in to comment.