Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Commit c367164

Browse files
nikomatsakisClaude
andcommitted
Refactor sendToActiveTerminal to use mandatory options object
- Change second parameter from optional boolean to mandatory options object - Require explicit { includeNewline: boolean } in all calls - Makes the API more explicit and extensible for future options - Ask Socratic Shell uses { includeNewline: false } - Walkthrough uses { includeNewline: true } Co-authored-by: Claude <[email protected]>
1 parent a7fb872 commit c367164

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

extension/src/bus.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class Bus {
121121
* Send reference data to active terminal with consolidated logic
122122
* Handles terminal finding, reference creation, and XML generation
123123
*/
124-
async sendToActiveTerminal(referenceData: any, includeNewline: boolean = true): Promise<void> {
124+
async sendToActiveTerminal(referenceData: any, options: { includeNewline: boolean }): Promise<void> {
125125
const selectedTerminal = await this.selectActiveTerminal();
126126
if (!selectedTerminal) return;
127127

@@ -134,7 +134,7 @@ export class Bus {
134134
}
135135

136136
// Generate <ssref id="..."/> XML (using current format)
137-
const xmlMessage = `<ssref id="${referenceId}"/>` + (includeNewline ? '\n\n' : '');
137+
const xmlMessage = `<ssref id="${referenceId}"/>` + (options.includeNewline ? '\n\n' : '');
138138

139139
// Send XML to terminal
140140
selectedTerminal.terminal.sendText(xmlMessage, false); // false = don't execute, just insert text

extension/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ function setupSelectionDetection(bus: Bus): void {
10761076
selectedText: selectedText,
10771077
};
10781078

1079-
await bus.sendToActiveTerminal(referenceData, false);
1079+
await bus.sendToActiveTerminal(referenceData, { includeNewline: false });
10801080
outputChannel.appendLine(`Compact reference sent for ${relativePath}:${startLine}`);
10811081
} catch (error) {
10821082
outputChannel.appendLine(`Failed to send reference: ${error}`);

extension/src/walkthroughWebview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ export class WalkthroughWebviewProvider implements vscode.WebviewViewProvider {
767767
user_comment: text
768768
};
769769

770-
await this.bus.sendToActiveTerminal(referenceData);
770+
await this.bus.sendToActiveTerminal(referenceData, { includeNewline: true });
771771
this.bus.outputChannel.appendLine(`Comment reply sent as compact reference for ${filePath}:${lineNumber}`);
772772
} catch (error) {
773773
console.error('[WALKTHROUGH] Error sending comment to shell:', error);

0 commit comments

Comments
 (0)