Skip to content

Commit b8f340c

Browse files
committed
feat: add Coder Ping Workspace command (#749)
Add a `coder.pingWorkspace` command that runs `coder ping <workspace>` locally and streams output to a custom PTY terminal. This helps users diagnose connection problems by showing latency, P2P diagnostics, and DERP info in real-time. The command supports three invocation modes: - Command Palette: shows a workspace picker (filtered to running) - Sidebar context menu: under a new "Diagnostics" submenu - When connected: pings the current workspace automatically Other changes: - Extract `resolveCliEnv` to deduplicate CLI bootstrap boilerplate - Parameterize `pickWorkspace` with filter/title options and fix QuickPick disposal leak - Encode workspace running status in tree item contextValue using a tag-based format (e.g. `coderWorkspaceSingleAgent+running`) so status-dependent menus use regex matching
1 parent 0c3c250 commit b8f340c

File tree

4 files changed

+292
-67
lines changed

4 files changed

+292
-67
lines changed

package.json

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@
259259
"when": "!coder.authenticated && coder.loaded"
260260
}
261261
],
262+
"submenus": [
263+
{
264+
"id": "coder.diagnostics",
265+
"label": "Diagnostics"
266+
}
267+
],
262268
"commands": [
263269
{
264270
"command": "coder.login",
@@ -368,6 +374,11 @@
368374
"command": "coder.applyRecommendedSettings",
369375
"title": "Apply Recommended SSH Settings",
370376
"category": "Coder"
377+
},
378+
{
379+
"command": "coder.pingWorkspace",
380+
"title": "Ping Workspace",
381+
"category": "Coder"
371382
}
372383
],
373384
"menus": {
@@ -400,6 +411,10 @@
400411
"command": "coder.navigateToWorkspaceSettings",
401412
"when": "coder.workspace.connected"
402413
},
414+
{
415+
"command": "coder.pingWorkspace",
416+
"when": "coder.authenticated"
417+
},
403418
{
404419
"command": "coder.workspace.update",
405420
"when": "coder.workspace.updatable"
@@ -494,18 +509,28 @@
494509
"view/item/context": [
495510
{
496511
"command": "coder.openFromSidebar",
497-
"when": "coder.authenticated && viewItem == coderWorkspaceSingleAgent || coder.authenticated && viewItem == coderAgent",
512+
"when": "coder.authenticated && viewItem =~ /^coderWorkspaceSingleAgent/ || coder.authenticated && viewItem =~ /^coderAgent/",
498513
"group": "inline"
499514
},
500515
{
501516
"command": "coder.navigateToWorkspace",
502-
"when": "coder.authenticated && viewItem == coderWorkspaceSingleAgent || coder.authenticated && viewItem == coderWorkspaceMultipleAgents",
517+
"when": "coder.authenticated && viewItem =~ /^coderWorkspaceSingleAgent/ || coder.authenticated && viewItem =~ /^coderWorkspaceMultipleAgents/",
503518
"group": "inline"
504519
},
505520
{
506521
"command": "coder.navigateToWorkspaceSettings",
507-
"when": "coder.authenticated && viewItem == coderWorkspaceSingleAgent || coder.authenticated && viewItem == coderWorkspaceMultipleAgents",
522+
"when": "coder.authenticated && viewItem =~ /^coderWorkspaceSingleAgent/ || coder.authenticated && viewItem =~ /^coderWorkspaceMultipleAgents/",
508523
"group": "inline"
524+
},
525+
{
526+
"submenu": "coder.diagnostics",
527+
"when": "coder.authenticated && viewItem =~ /\\+running/",
528+
"group": "navigation"
529+
}
530+
],
531+
"coder.diagnostics": [
532+
{
533+
"command": "coder.pingWorkspace"
509534
}
510535
],
511536
"statusBar/remoteIndicator": [

0 commit comments

Comments
 (0)