Skip to content

Commit bbb0391

Browse files
committed
Show Remote SSH Output panel on workspace start
1 parent f9b1f25 commit bbb0391

File tree

3 files changed

+70
-6
lines changed

3 files changed

+70
-6
lines changed

CLAUDE.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,43 @@
11
# Coder Extension Development Guidelines
22

3+
## Working Style
4+
5+
You're an experienced, pragmatic engineer. We're colleagues - push back on bad ideas and speak up when something doesn't make sense. Honesty over agreeableness.
6+
7+
- Simple solutions over clever ones. Readability is a primary concern.
8+
- YAGNI - don't add features we don't need right now
9+
- Make the smallest reasonable changes to achieve the goal
10+
- Reduce code duplication, even if it takes extra effort
11+
- Match the style of surrounding code - consistency within a file matters
12+
- Fix bugs immediately when you find them
13+
14+
## Naming and Comments
15+
16+
Names should describe what code does, not how it's implemented:
17+
18+
- Good: `Tool`, `RemoteTool`, `execute()`
19+
- Bad: `MCPToolWrapper`, `NewAPI`, `executeToolWithValidation()`
20+
21+
Comments explain what code does or why it exists:
22+
23+
- Never add comments about what used to be there or how things changed
24+
- Never use temporal terms like "new", "improved", "refactored", "legacy"
25+
- Code should be evergreen - describe it as it is
26+
- Do not add comments when you can instead use proper variable/function naming
27+
28+
## Testing and Debugging
29+
30+
- Tests must comprehensively cover functionality
31+
- Never mock behavior in end-to-end tests - use real data
32+
- Mock as little as possible in unit tests - try to use real data
33+
- Find root causes, not symptoms. Read error messages carefully before attempting fixes.
34+
35+
## Version Control
36+
37+
- Commit frequently throughout development
38+
- Never skip or disable pre-commit hooks
39+
- Check `git status` before using `git add`
40+
341
## Build and Test Commands
442

543
- Build: `yarn build`
@@ -8,20 +46,22 @@
846
- Lint: `yarn lint`
947
- Lint with auto-fix: `yarn lint:fix`
1048
- Run all tests: `yarn test`
11-
- Run specific test: `vitest ./src/filename.test.ts`
12-
- CI test mode: `yarn test:ci`
49+
- Unit tests: `yarn test:ci`
1350
- Integration tests: `yarn test:integration`
51+
- Run specific unit test: `yarn test:ci ./test/unit/filename.test.ts`
52+
- Run specific integration test: `yarn test:integration ./test/integration/filename.test.ts`
1453

15-
## Code Style Guidelines
54+
## Code Style
1655

1756
- TypeScript with strict typing
18-
- No semicolons (see `.prettierrc`)
57+
- Use semicolons
1958
- Trailing commas for all multi-line lists
2059
- 120 character line width
2160
- Use ES6 features (arrow functions, destructuring, etc.)
2261
- Use `const` by default; `let` only when necessary
62+
- Never use `any`, and use exact types when you can
2363
- Prefix unused variables with underscore (e.g., `_unused`)
24-
- Sort imports alphabetically in groups: external → parent → sibling
64+
- Sort imports alphabetically in groups (see `import/order` in `.eslintrc.json`): external → parent → sibling
2565
- Error handling: wrap and type errors appropriately
2666
- Use async/await for promises, avoid explicit Promise construction where possible
27-
- Test files must be named `*.test.ts` and use Vitest
67+
- Unit test files must be named `*.test.ts` and use Vitest, they should be placed in `./test/unit/<path in src>`

src/extension.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
353353
}),
354354
);
355355

356+
let shouldShowSshOutput = false;
356357
// Since the "onResolveRemoteAuthority:ssh-remote" activation event exists
357358
// in package.json we're able to perform actions before the authority is
358359
// resolved by the remote SSH extension.
@@ -370,6 +371,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
370371
);
371372
if (details) {
372373
ctx.subscriptions.push(details);
374+
shouldShowSshOutput = details.startedWorkspace;
373375
// Authenticate the plugin client which is used in the sidebar to display
374376
// workspaces belonging to this deployment.
375377
client.setHost(details.url);
@@ -460,9 +462,27 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
460462
}
461463
}
462464
}
465+
466+
if (shouldShowSshOutput) {
467+
showSshOutput();
468+
}
463469
}
464470

465471
async function showTreeViewSearch(id: string): Promise<void> {
466472
await vscode.commands.executeCommand(`${id}.focus`);
467473
await vscode.commands.executeCommand("list.find");
468474
}
475+
476+
function showSshOutput(): void {
477+
for (const command of [
478+
"opensshremotes.showLog",
479+
"windsurf-remote-openssh.showLog",
480+
]) {
481+
/**
482+
* We must not await this command because
483+
* 1) it may not exist
484+
* 2) it might cause the Remote SSH extension to be loaded synchronously
485+
*/
486+
void vscode.commands.executeCommand(command);
487+
}
488+
}

src/remote/remote.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { computeSSHProperties, sshSupportsSetEnv } from "./sshSupport";
5151
export interface RemoteDetails extends vscode.Disposable {
5252
url: string;
5353
token: string;
54+
startedWorkspace: boolean;
5455
}
5556

5657
export class Remote {
@@ -415,6 +416,7 @@ export class Remote {
415416
}
416417
}
417418

419+
let startedWorkspace = false;
418420
const disposables: vscode.Disposable[] = [];
419421
try {
420422
// Register before connection so the label still displays!
@@ -442,6 +444,7 @@ export class Remote {
442444
await this.closeRemote();
443445
return;
444446
}
447+
startedWorkspace = true;
445448
workspace = updatedWorkspace;
446449
}
447450
this.commands.workspace = workspace;
@@ -681,6 +684,7 @@ export class Remote {
681684
return {
682685
url: baseUrlRaw,
683686
token,
687+
startedWorkspace,
684688
dispose: () => {
685689
disposables.forEach((d) => d.dispose());
686690
},

0 commit comments

Comments
 (0)