MCPcopy Create free account
hub / github.com/Marus/cortex-debug / getTreeItem

Method getTreeItem

src/frontend/views/live-watch.ts:71–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69 }
70
71 public getTreeItem(): TreeItem | Promise<TreeItem> {
72 const state = this.variablesReference || (this.children?.length > 0) ?
73 (this.children?.length > 0 ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.Collapsed) : TreeItemCollapsibleState.None;
74
75 const parts = this.name.startsWith('\'') && this.isRootChild() ? this.name.split('\'::') : [this.name];
76 const name = parts.pop();
77 const label: vscode.TreeItemLabel = {
78 label: name + ': ' + (this.value || 'not available')
79 };
80 if (this.prevValue && (this.prevValue !== this.value)) {
81 label.highlights = [[name.length + 2, label.label.length]];
82 }
83 this.prevValue = this.value;
84
85 const item = new TreeItem(label, state);
86 item.contextValue = this.isRootChild() ? 'expression' : 'field';
87 let file = parts.length ? parts[0].slice(1) : '';
88 if (file) {
89 const cwd = this.session?.configuration?.cwd;
90 file = cwd ? getPathRelative(cwd, file) : file;
91 }
92 item.tooltip = (file ? 'File: ' + file + '\n' : '') + this.type;
93 return item;
94 }
95
96 public getCopyValue(): string {
97 throw new Error('Method not implemented.');

Callers 1

getTreeItemMethod · 0.45

Calls 2

isRootChildMethod · 0.95
getPathRelativeFunction · 0.90

Tested by

no test coverage detected