Skip to content

CONTEXT KEYS CLEANUP#322783

Merged
benibenj merged 1 commit into
mainfrom
benibenj/enormous-silkworm
Jun 24, 2026
Merged

CONTEXT KEYS CLEANUP#322783
benibenj merged 1 commit into
mainfrom
benibenj/enormous-silkworm

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

Copilot Generated Description: Refactor context keys for session management by renaming and consolidating keys for clarity and consistency across the application. This includes updates to context keys related to session types and providers. Adjustments made to imports and usage throughout the codebase to reflect these changes.

Copilot AI review requested due to automatic review settings June 24, 2026 17:53
@benibenj benibenj enabled auto-merge June 24, 2026 17:53
@benibenj benibenj self-assigned this Jun 24, 2026
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

@sandy081

Matched files:

  • src/vs/sessions/services/sessions/browser/sessionsService.ts
  • src/vs/sessions/services/sessions/common/sessionContextKeys.ts
  • src/vs/sessions/services/sessions/common/sessionsManagement.ts

@lszomoru

Matched files:

  • src/vs/sessions/services/sessions/browser/sessionsService.ts
  • src/vs/sessions/services/sessions/common/sessionContextKeys.ts
  • src/vs/sessions/services/sessions/common/sessionsManagement.ts

@joshspicer joshspicer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WOOOO

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 the Sessions window context keys by consolidating “active session” and context-menu overlay keys into a single set (sessionType, sessionProviderId, etc.), and centralizes the logic for applying those keys via a new helper in the sessions service layer. It also updates usages across sessions contributions, provider docs, and Copilot extension menu when clauses to align with the renamed keys.

Changes:

  • Replace activeSession* and chatSession* overlay context keys with unified session* context keys.
  • Add setSessionContextKeys / setActiveSessionContextKeys helper to apply all session-derived keys consistently and efficiently (cached bindings).
  • Update Sessions window actions/menus/docs and Copilot extension contribution when clauses to use the new key names.
Show a summary per file
File Description
src/vs/sessions/SESSIONS.md Update rename gating docs to reference sessionSupportsRename.
src/vs/sessions/SESSIONS_LIST.md Update documentation/examples and context key list to sessionType / sessionProviderId.
src/vs/sessions/services/sessions/common/sessionsManagement.ts Remove unused exported context key and its imports.
src/vs/sessions/services/sessions/common/sessionContextKeys.ts New helper to bind/cache and apply session-derived context keys to a context service.
src/vs/sessions/services/sessions/browser/sessionsService.ts Switch active-session context key updates to use the new helper; remove bespoke key wiring.
src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.ts Update rename/delete/archive gating to use unified session context keys.
src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts Update item overlay keys to sessionType / sessionProviderId / sessionSupports*.
src/vs/sessions/contrib/sessions/browser/sessionsActions.ts Update provider-based gating to use SessionProviderIdContext.
src/vs/sessions/contrib/providers/localChatSessions/LOCAL_CHAT_SESSIONS_PROVIDER.md Update docs to reference renamed context keys.
src/vs/sessions/contrib/providers/copilotChatSessions/COPILOT_CHAT_SESSIONS_PROVIDER.md Update docs to reference renamed context keys.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.ts Replace ActiveSession* keys with unified Session* keys in menu gating and bindings.
src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileChatInputConfigPicker.ts Rename combined-picker gating key to SessionUsesCombinedConfigPickerContext.
src/vs/sessions/contrib/providers/agentHost/browser/agentSessionSettings.contribution.ts Update regex gating to SessionProviderIdContext.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettings.contribution.ts Update regex gating to SessionProviderIdContext.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionConfigPicker.ts Update provider gating to SessionProviderIdContext.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionBranchActions.ts Update provider gating to SessionProviderIdContext.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostAgentPicker.ts Update provider gating to SessionProviderIdContext.
src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md Update docs to reference renamed delete-gating key.
src/vs/sessions/contrib/files/browser/files.contribution.ts Rename git repository/sync gating keys to unified Session* variants.
src/vs/sessions/contrib/codeReview/browser/codeReview.contributions.ts Update workspace-virtual and provider gating keys to unified Session* keys.
src/vs/sessions/contrib/chat/browser/runScriptAction.ts Update workspace-virtual gating to SessionWorkspaceIsVirtualContext.
src/vs/sessions/contrib/chat/browser/modelPicker.ts Update combined-picker gating to SessionUsesCombinedConfigPickerContext.
src/vs/sessions/contrib/applyCommitsToParentRepo/browser/applyChangesToParentRepo.ts Replace IsActiveSessionArchivedContext with SessionIsArchivedContext.
src/vs/sessions/common/contextkeys.ts Define the new unified Session* context keys and remove the old ActiveSession*/ChatSession* overlay keys.
src/vs/sessions/browser/parts/sessionView.ts Replace per-key autoruns with a single autorun using setActiveSessionContextKeys on the scoped context service.
extensions/copilot/package.json Update Sessions-window when clauses to use sessionType / sessionProviderId / sessionIsArchived.
.github/instructions/sessions.instructions.md Update contributor instructions to reflect the new context key names.

Copilot's findings

  • Files reviewed: 27/27 changed files
  • Comments generated: 2

Comment on lines 11 to +16
export const IsNewChatSessionContext = new RawContextKey<boolean>('isNewChatSession', true);
export const ActiveSessionProviderIdContext = new RawContextKey<string>('activeSessionProviderId', '', localize('activeSessionProviderId', "The provider ID of the active session"));
export const ActiveSessionTypeContext = new RawContextKey<string>('activeSessionType', '', localize('activeSessionType', "The session type of the active session"));
export const ActiveSessionWorkspaceIsVirtualContext = new RawContextKey<boolean>('activeSessionWorkspaceIsVirtual', true, localize('activeSessionWorkspaceIsVirtual', "Whether the active session's workspace is virtual"));
export const IsActiveSessionArchivedContext = new RawContextKey<boolean>('isActiveSessionArchived', false, localize('isActiveSessionArchived', "Whether the active session is archived (marked as done)"));
export const ActiveSessionHasGitRepositoryContext = new RawContextKey<boolean>('activeSessionHasGitRepository', false, localize('activeSessionHasGitRepository', "Whether the active session has an associated git repository"));
export const ActiveSessionHasGitSyncActionRunningContext = new RawContextKey<boolean>('activeSessionHasGitSyncActionRunning', false, localize('activeSessionHasGitSyncActionRunning', "Whether the active session has a git sync action currently running"));
export const ActiveSessionUsesCombinedConfigPickerContext = new RawContextKey<boolean>('activeSessionUsesCombinedConfigPicker', false, localize('activeSessionUsesCombinedConfigPicker', "Whether the active session's provider offers a combined mode and model configuration picker (used on phone layouts in place of the standalone pickers)"));
export const ChatSessionProviderIdContext = new RawContextKey<string>('chatSessionProviderId', '', localize('chatSessionProviderId', "The provider ID of a session in context menu overlays"));
export const ChatSessionTypeContext = new RawContextKey<string>('chatSessionType', '', localize('chatSessionType', "The session type of a session in context menu overlays"));
export const ChatSessionSupportsRenameContext = new RawContextKey<boolean>('chatSessionSupportsRename', false, localize('chatSessionSupportsRename', "Whether a session in context menu overlays can be renamed"));
export const ChatSessionSupportsDeleteContext = new RawContextKey<boolean>('chatSessionSupportsDelete', false, localize('chatSessionSupportsDelete', "Whether a session in context menu overlays can be deleted"));
export const SessionProviderIdContext = new RawContextKey<string>('sessionProviderId', '', localize('sessionProviderId', "The provider ID of the session in scope (the active session globally, or a specific session within an isolated component such as the session view or a context menu overlay)"));
export const SessionTypeContext = new RawContextKey<string>('sessionType', '', localize('sessionType', "The session type of the session in scope (the active session globally, or a specific session within an isolated component such as the session view or a context menu overlay)"));
export const SessionWorkspaceIsVirtualContext = new RawContextKey<boolean>('sessionWorkspaceIsVirtual', true, localize('sessionWorkspaceIsVirtual', "Whether the session's workspace is virtual"));
export const SessionHasGitRepositoryContext = new RawContextKey<boolean>('sessionHasGitRepository', false, localize('sessionHasGitRepository', "Whether the session has an associated git repository"));
export const SessionHasGitSyncActionRunningContext = new RawContextKey<boolean>('sessionHasGitSyncActionRunning', false, localize('sessionHasGitSyncActionRunning', "Whether the session has a git sync action currently running"));
Comment on lines 6293 to 6297
{
"command": "github.copilot.claude.sessions.rename",
"when": "chatSessionType == claude-code && chatSessionProviderId == default-copilot",
"when": "sessionType == claude-code && sessionProviderId == default-copilot",
"group": "1_edit@4"
},
@benibenj benibenj merged commit ccaabd4 into main Jun 24, 2026
29 checks passed
@benibenj benibenj deleted the benibenj/enormous-silkworm branch June 24, 2026 18:11
@vs-code-engineering vs-code-engineering Bot added this to the 1.127.0 milestone Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants