Skip to content

Commit

Permalink
Add command and button to copy remote serial
Browse files Browse the repository at this point in the history
  • Loading branch information
nisargjhaveri committed Jan 10, 2025
1 parent 7bfcdea commit 9d768a8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
32 changes: 23 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
],
"view/item/context": [
{
"command": "remote-adb.removeTcpDevice",
"when": "viewItem =~ /;removable;/",
"command": "remote-adb.copyRemoteSerial",
"when": "viewItem =~ /;connected;/",
"group": "inline@1"
},
{
Expand All @@ -66,17 +66,25 @@
"when": "viewItem =~ /;connected;/",
"group": "inline@2"
},
{
"command": "remote-adb.removeTcpDevice",
"when": "viewItem =~ /;removable;/"
},
{
"command": "remote-adb.connectDevice",
"when": "viewItem =~ /;disconnected;/"
"when": "viewItem =~ /;disconnected;/",
"group": "navigation@1"
},
{
"command": "remote-adb.disconnectDevice",
"when": "viewItem =~ /;connected;/"
"when": "viewItem =~ /;connected;/",
"group": "navigation@1"
},
{
"command": "remote-adb.removeTcpDevice",
"when": "viewItem =~ /;removable;/",
"group": "navigation@2"
},
{
"command": "remote-adb.copyRemoteSerial",
"when": "viewItem =~ /;connected;/",
"group": "1_copy"
}
]
},
Expand All @@ -95,9 +103,15 @@
"icon": "$(debug-disconnect)",
"enablement": "view == remote-adb"
},
{
"command": "remote-adb.copyRemoteSerial",
"title": "Copy remote serial",
"icon": "$(copy)",
"enablement": "view == remote-adb"
},
{
"command": "remote-adb.addTcpDevice",
"title": "Add TCP Device",
"title": "Add TCP device",
"icon": "$(plus)",
"category": "Remote Android"
},
Expand Down
6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export function activate(context: vscode.ExtensionContext) {
}
}));

context.subscriptions.push(vscode.commands.registerCommand('remote-adb.copyRemoteSerial', async (treeItem: RemoteAdbDeviceWrapper) => {
if (treeItem?.device?.remoteSerial) {
await vscode.env.clipboard.writeText(treeItem.device.remoteSerial);
}
}));

context.subscriptions.push(vscode.commands.registerCommand('remote-adb.addTcpDevice', async () => {
let serial = await vscode.window.showInputBox({
"title": "Add a device via TCP/IP",
Expand Down

0 comments on commit 9d768a8

Please sign in to comment.