Skip to content

Add switchToPreviousModel command#293129

Open
pedrocostadev wants to merge 3 commits intomicrosoft:mainfrom
pedrocostadev:add-switch-to-previous-model
Open

Add switchToPreviousModel command#293129
pedrocostadev wants to merge 3 commits intomicrosoft:mainfrom
pedrocostadev:add-switch-to-previous-model

Conversation

@pedrocostadev
Copy link
Copy Markdown

Summary

  • Adds workbench.action.chat.switchToPreviousModel command — reverse of switchToNextModel
  • Mirrors existing forward-cycling logic with (index - 1 + length) % length
  • Registered in command palette under Chat category

Fixes #271718

Test plan

  • Open Copilot Chat, use Command Palette > "Switch to Previous Model" — cycles backward through available models
  • Wraps around from first model to last
  • "Switch to Next Model" still works as before

🤖 Generated with Claude Code

Fixes microsoft#271718

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 5, 2026 15:23
@pedrocostadev
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copy link
Copy Markdown
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 adds a workbench.action.chat.switchToPreviousModel command to enable backward cycling through available chat models in GitHub Copilot, complementing the existing forward-cycling switchToNextModel command.

Changes:

  • Added switchToPreviousModel() method in ChatInputPart class that cycles backward through models using modulo arithmetic
  • Created SwitchToPreviousModelAction action class with proper command registration and localization
  • Registered the new action in the chat execute actions registry

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts Implements the switchToPreviousModel() method with backward cycling logic that wraps around from the first model to the last
src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts Defines SwitchToPreviousModelAction class mirroring SwitchToNextModelAction structure and registers it in the command palette

Tests the index calculation logic for model cycling:
- Forward cycling (switchToNextModel)
- Backward cycling (switchToPreviousModel)
- Wrap-around behavior at boundaries
- Edge cases (single model, model not found)
- Bidirectional cycling consistency
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.

GitHub Copilot missing workbench.action.chat.switchToPreviousModel

3 participants