Skip to content

chat: cleanup most flagrant usages of IChatWidgetService.lastFocusedWidget#278861

Merged
connor4312 merged 1 commit intomainfrom
connor4312/278638
Nov 21, 2025
Merged

chat: cleanup most flagrant usages of IChatWidgetService.lastFocusedWidget#278861
connor4312 merged 1 commit intomainfrom
connor4312/278638

Conversation

@connor4312
Copy link
Member

Closes #278638 mostly

Copilot AI review requested due to automatic review settings November 21, 2025 20:33
@connor4312 connor4312 enabled auto-merge (squash) November 21, 2025 20:33
@connor4312 connor4312 self-assigned this Nov 21, 2025
@vs-code-engineering
Copy link

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@jrieken

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.ts

@bpasero

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatInputPart.ts

@roblourens

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 sessionResource parameter to slash command callback signatures for better widget targeting
  • Replaced lastFocusedWidget usage with getWidgetBySessionResource() where session context is available
  • Updated components to accept widget references via constructor instead of accessing via service
  • Added warning documentation to lastFocusedWidget property 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

@connor4312 connor4312 merged commit 9243a00 into main Nov 21, 2025
33 of 34 checks passed
@connor4312 connor4312 deleted the connor4312/278638 branch November 21, 2025 20:52
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review usages of IChatWidgetService.lastFocusedWidget

3 participants