-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: preserve chat input focus during automated file editing (#4574) #5282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -504,7 +504,7 @@ export class DiffViewProvider { | |||||
| // Pre-open the file as a text document to ensure it doesn't open in preview mode | ||||||
| // This fixes issues with files that have custom editor associations (like markdown preview) | ||||||
| vscode.window | ||||||
| .showTextDocument(uri, { preview: false, viewColumn: vscode.ViewColumn.Active }) | ||||||
| .showTextDocument(uri, { preview: false, viewColumn: vscode.ViewColumn.Active, preserveFocus: true }) | ||||||
|
||||||
| .showTextDocument(uri, { preview: false, viewColumn: vscode.ViewColumn.Active, preserveFocus: true }) | |
| .showTextDocument(uri, showOptions) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -176,7 +176,7 @@ describe("DiffViewProvider", () => { | |||||
| // Mock showTextDocument to track when it's called | ||||||
| vi.mocked(vscode.window.showTextDocument).mockImplementation(async (uri, options) => { | ||||||
| callOrder.push("showTextDocument") | ||||||
| expect(options).toEqual({ preview: false, viewColumn: vscode.ViewColumn.Active }) | ||||||
| expect(options).toEqual({ preview: false, viewColumn: vscode.ViewColumn.Active, preserveFocus: true }) | ||||||
|
||||||
| expect(options).toEqual({ preview: false, viewColumn: vscode.ViewColumn.Active, preserveFocus: true }) | |
| expect(options).toEqual(expect.objectContaining({ preview: false, viewColumn: vscode.ViewColumn.Active, preserveFocus: true })) |
Outdated
Copilot
AI
Jun 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Similarly, this exact match could break if additional options are introduced. Using expect.objectContaining for the options object will make the test more resilient.
| { preview: false, viewColumn: vscode.ViewColumn.Active, preserveFocus: true }, | |
| expect.objectContaining({ preview: false, viewColumn: vscode.ViewColumn.Active, preserveFocus: true }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're now also preserving focus to fix the chat input issue, would it be helpful to update this comment to reflect both purposes? Something like: