chat: cleanup most flagrant usages of IChatWidgetService.lastFocusedWidget#278861
Merged
connor4312 merged 1 commit intomainfrom Nov 21, 2025
Merged
chat: cleanup most flagrant usages of IChatWidgetService.lastFocusedWidget#278861connor4312 merged 1 commit intomainfrom
connor4312 merged 1 commit intomainfrom
Conversation
…idget Closes #278638 mostly
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @jriekenMatched files:
@bpaseroMatched files:
@roblourensMatched files:
|
rebornix
approved these changes
Nov 21, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors chat widget access patterns to reduce reliance on IChatWidgetService.lastFocusedWidget by using more specific widget retrieval methods when session context is available. This improves support for multiple concurrent chat widgets.
Key Changes
- Added
sessionResourceparameter to slash command callback signatures for better widget targeting - Replaced
lastFocusedWidgetusage withgetWidgetBySessionResource()where session context is available - Updated components to accept widget references via constructor instead of accessing via service
- Added warning documentation to
lastFocusedWidgetproperty about its appropriate usage
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| notebook.chat.contribution.ts | Renamed action class and switched to revealWidget() for widget access |
| chatSlashCommands.ts | Added sessionResource parameter to slash command callback type signatures |
| chatServiceImpl.ts | Pass sessionResource when executing slash commands |
| chatInputCompletions.ts | Use revealWidget() instead of lastFocusedWidget for starting parameterized prompts |
| chatMarkdownDecorationsRenderer.ts | Thread sessionResource through markdown conversion and use getWidgetBySessionResource() with fallback |
| chatListRenderer.ts | Pass sessionResource to markdown conversion methods |
| chatInputPart.ts | Pass widget reference function to child components instead of relying on service |
| chatEditingActions.ts | Use getWidgetBySessionResource() when item context is available, with fallback to lastFocusedWidget |
| chatDragAndDrop.ts | Accept widget reference function instead of service dependency, reorder imports |
| chat.ts | Add warning documentation to lastFocusedWidget property |
| chat.contribution.ts | Pass sessionResource to agent markdown conversion functions |
| implicitContextAttachment.ts | Accept widget reference function instead of service dependency |
| chatNewActions.ts | Use getWidgetBySessionResource() and direct session access instead of widget service |
| chatCopyActions.ts | Use getWidgetBySessionResource() when context includes session resource |
| chatAccessibilityActions.ts | Find widget with pending input instead of using lastFocusedWidget |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #278638 mostly