Skip to content

Commit

Permalink
issue Marus#370: split commands for pin/unpin peripherals
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Argüelles <manu.argue@gmail.com>
  • Loading branch information
manuargue committed Jan 22, 2021
1 parent 8fcc626 commit 90916e8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
24 changes: 19 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,15 @@
"title": "Refresh"
},
{
"command": "cortex-debug.peripherals.togglePin",
"title": "Toggle Pin",
"command": "cortex-debug.peripherals.pin",
"title": "Pin",
"icon": "$(pin)"
},
{
"command": "cortex-debug.peripherals.unpin",
"title": "Unpin",
"icon": "$(pinned)"
},
{
"category": "Cortex-Debug",
"command": "cortex-debug.examineMemory",
Expand Down Expand Up @@ -1453,7 +1458,11 @@
"when": "false"
},
{
"command": "cortex-debug.peripherals.togglePin",
"command": "cortex-debug.peripherals.pin",
"when": "false"
},
{
"command": "cortex-debug.peripherals.unpin",
"when": "false"
},
{
Expand Down Expand Up @@ -1523,13 +1532,18 @@
},
{
"command": "cortex-debug.peripherals.forceRefresh",
"when": "view == cortex-debug.peripherals && viewItem == peripheral"
"when": "view == cortex-debug.peripherals && viewItem =~ /peripheral.*/"
},
{
"command": "cortex-debug.peripherals.togglePin",
"command": "cortex-debug.peripherals.pin",
"when": "view == cortex-debug.peripherals && viewItem == peripheral",
"group": "inline"
},
{
"command": "cortex-debug.peripherals.unpin",
"when": "view == cortex-debug.peripherals && viewItem == peripheral.pinned",
"group": "inline"
},
{
"command": "cortex-debug.registers.copyValue",
"when": "view == cortex-debug.registers && viewItem == register",
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export class CortexDebugExtension {
vscode.commands.registerCommand('cortex-debug.peripherals.copyValue', this.peripheralsCopyValue.bind(this)),
vscode.commands.registerCommand('cortex-debug.peripherals.setFormat', this.peripheralsSetFormat.bind(this)),
vscode.commands.registerCommand('cortex-debug.peripherals.forceRefresh', this.peripheralsForceRefresh.bind(this)),
vscode.commands.registerCommand('cortex-debug.peripherals.togglePin', this.peripheralsTogglePin.bind(this)),
vscode.commands.registerCommand('cortex-debug.peripherals.pin', this.peripheralsTogglePin.bind(this)),
vscode.commands.registerCommand('cortex-debug.peripherals.unpin', this.peripheralsTogglePin.bind(this)),

vscode.commands.registerCommand('cortex-debug.registers.copyValue', this.registersCopyValue.bind(this)),

Expand Down
7 changes: 2 additions & 5 deletions src/frontend/views/nodes/peripheralnode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TreeItem, TreeItemCollapsibleState, ThemeIcon } from 'vscode';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { AccessType } from '../../svd';
import { PeripheralBaseNode } from './basenode';
import { AddrRange, AddressRangesInUse } from '../../addrranges';
Expand Down Expand Up @@ -56,11 +56,8 @@ export class PeripheralNode extends PeripheralBaseNode {
public getTreeItem(): TreeItem | Promise<TreeItem> {
const label = `${this.name} @ ${hexFormat(this.baseAddress)}`;
const item = new TreeItem(label, this.expanded ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.Collapsed);
item.contextValue = 'peripheral';
item.contextValue = this.pinned ? 'peripheral.pinned' : 'peripheral';
item.tooltip = this.description;
if (this.pinned)
// TODO: requires to update vscode to new typing dependency
item.iconPath = new ThemeIcon('pinned');
return item;
}

Expand Down

0 comments on commit 90916e8

Please sign in to comment.