Skip to content

Commit 196ed90

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 c9e552d commit 196ed90

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",
@@ -363,6 +369,11 @@
363369
"command": "coder.applyRecommendedSettings",
364370
"title": "Apply Recommended SSH Settings",
365371
"category": "Coder"
372+
},
373+
{
374+
"command": "coder.pingWorkspace",
375+
"title": "Ping Workspace",
376+
"category": "Coder"
366377
}
367378
],
368379
"menus": {
@@ -391,6 +402,10 @@
391402
"command": "coder.navigateToWorkspaceSettings",
392403
"when": "coder.workspace.connected"
393404
},
405+
{
406+
"command": "coder.pingWorkspace",
407+
"when": "coder.authenticated"
408+
},
394409
{
395410
"command": "coder.workspace.update",
396411
"when": "coder.workspace.updatable"
@@ -485,18 +500,28 @@
485500
"view/item/context": [
486501
{
487502
"command": "coder.openFromSidebar",
488-
"when": "coder.authenticated && viewItem == coderWorkspaceSingleAgent || coder.authenticated && viewItem == coderAgent",
503+
"when": "coder.authenticated && viewItem =~ /^coderWorkspaceSingleAgent/ || coder.authenticated && viewItem =~ /^coderAgent/",
489504
"group": "inline"
490505
},
491506
{
492507
"command": "coder.navigateToWorkspace",
493-
"when": "coder.authenticated && viewItem == coderWorkspaceSingleAgent || coder.authenticated && viewItem == coderWorkspaceMultipleAgents",
508+
"when": "coder.authenticated && viewItem =~ /^coderWorkspaceSingleAgent/ || coder.authenticated && viewItem =~ /^coderWorkspaceMultipleAgents/",
494509
"group": "inline"
495510
},
496511
{
497512
"command": "coder.navigateToWorkspaceSettings",
498-
"when": "coder.authenticated && viewItem == coderWorkspaceSingleAgent || coder.authenticated && viewItem == coderWorkspaceMultipleAgents",
513+
"when": "coder.authenticated && viewItem =~ /^coderWorkspaceSingleAgent/ || coder.authenticated && viewItem =~ /^coderWorkspaceMultipleAgents/",
499514
"group": "inline"
515+
},
516+
{
517+
"submenu": "coder.diagnostics",
518+
"when": "coder.authenticated && viewItem =~ /\\+running/",
519+
"group": "navigation"
520+
}
521+
],
522+
"coder.diagnostics": [
523+
{
524+
"command": "coder.pingWorkspace"
500525
}
501526
],
502527
"statusBar/remoteIndicator": [

0 commit comments

Comments
 (0)