Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@
"view/item/context": [
{
"command": "vscode-cmsis-debugger.liveWatch.modify",
"when": "view == cmsis-debugger.liveWatch && viewItem == expression",
"when": "view == cmsis-debugger.liveWatch",
"group": "inline@1"
},
{
"command": "vscode-cmsis-debugger.liveWatch.delete",
"when": "view == cmsis-debugger.liveWatch && viewItem == expression",
"when": "view == cmsis-debugger.liveWatch && viewItem == parentExpression",
"group": "inline@2"
},
{
Expand All @@ -254,17 +254,17 @@
},
{
"command": "vscode-cmsis-debugger.liveWatch.modify",
"when": "view == cmsis-debugger.liveWatch && viewItem == expression",
"when": "view == cmsis-debugger.liveWatch",
"group": "contextMenuG1@2"
},
{
"command": "vscode-cmsis-debugger.liveWatch.copy",
"when": "view == cmsis-debugger.liveWatch && viewItem == expression",
"when": "view == cmsis-debugger.liveWatch",
"group": "contextMenuG1@3"
},
{
"command": "vscode-cmsis-debugger.liveWatch.delete",
"when": "view == cmsis-debugger.liveWatch && viewItem == expression",
"when": "view == cmsis-debugger.liveWatch && viewItem == parentExpression",
"group": "contextMenuG1@4"
},
{
Expand All @@ -279,7 +279,7 @@
},
{
"command": "vscode-cmsis-debugger.liveWatch.showInMemoryInspector",
"when": "view == cmsis-debugger.liveWatch && viewItem == expression",
"when": "view == cmsis-debugger.liveWatch && viewItem == parentExpression",
"group": "contextMenuG3@1"
}
]
Expand Down
16 changes: 13 additions & 3 deletions src/views/live-watch/live-watch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,22 @@ describe('LiveWatchTreeDataProvider', () => {
expect(parent.children.length).toBe(0);
});

it('getTreeItem returns correct TreeItem', () => {
const node = makeNode('expression', { result: 'value', variablesReference: 1 }, 1);
it('returns correct TreeItem for parent nodes', () => {
const node = makeNode('expression', { result: 'value', variablesReference: 0 }, 1);
const item = liveWatchTreeDataProvider.getTreeItem(node);
expect(item.label).toBe('expression = ');
expect(item.description).toBe('value');
expect(item.contextValue).toBe('expression');
expect(item.contextValue).toBe('parentExpression');
});

it('returns correct TreeItem for leaf nodes', () => {
// Create a child node within a parent node
const parent = makeNode('parentExpression', { result: 'parentValue', variablesReference: 1 }, 1);
const child = makeNode('childExpression', { result: 'childValue', variablesReference: 0 }, 2, parent);
const item = liveWatchTreeDataProvider.getTreeItem(child);
expect(item.label).toBe('childExpression = ');
expect(item.description).toBe('childValue');
expect(item.contextValue).toBe('childExpression');
});
});

Expand Down
3 changes: 2 additions & 1 deletion src/views/live-watch/live-watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
item.contextValue = 'expression';
item.tooltip = element.value.type ?? '';
item.collapsibleState = element.value.variablesReference !== 0 ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None;
item.contextValue = element.parent ? 'childExpression' : 'parentExpression';
return item;
}

Expand Down Expand Up @@ -228,7 +229,7 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
if (!payload || !payload.variable) {
return;
}
await this.addToRoots(payload.variable.name);
await this.addToRoots(payload.variable.evaluateName ?? payload.variable.name);
}

private async handleShowInMemoryInspector(node: LiveWatchNode) {
Expand Down