⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 10, 2026

When the terminal is moved to the same pane as Copilot Chat (e.g., both in right sidebar), running terminal commands would permanently steal focus from Chat, requiring manual clicking to see responses.

Changes

Modified RunInTerminalTool._handleTerminalVisibility() to check view locations before revealing terminal:

  • Skip revealTerminal() when terminal and chat share the same view location (Panel/Sidebar/AuxiliaryBar)
  • Preserve existing reveal behavior when in different locations
  • Added IViewDescriptorService to compare TERMINAL_VIEW_ID and ChatViewId locations
private _handleTerminalVisibility(toolTerminal: IToolTerminal, chatSessionId: string) {
    const chatSessionOpenInWidget = !!this._chatWidgetService.getWidgetBySessionResource(...);
    if (this._configurationService.getValue(...) === 'terminal' && chatSessionOpenInWidget) {
        const terminalLocation = this._viewDescriptorService.getViewLocationById(TERMINAL_VIEW_ID);
        const chatLocation = this._viewDescriptorService.getViewLocationById(ChatViewId);
        if (terminalLocation && chatLocation && terminalLocation === chatLocation) {
            return; // Skip reveal - both in same pane
        }
        this._terminalService.setActiveInstance(toolTerminal.instance);
        this._terminalService.revealTerminal(toolTerminal.instance, true);
    }
}

Commands execute successfully in both scenarios. Focus management now respects UI layout.

Original prompt

This section details on the original issue you should resolve

<issue_title>Copilot setting focus to terminal ruins experience when terminal is also in right pane</issue_title>
<issue_description>

VS Code:

Version: 1.108.0 (user setup)
Commit: 94e8ae2
Date: 2026-01-08T13:53:10.781Z
Electron: 39.2.7
ElectronBuildId: 12953945
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26100

  • Copilot Chat Extension Version: 0.36.0
  • Feature (e.g. agent/edit/ask mode): All
  • Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): All

Steps to Reproduce:

  1. Move the terminal to be in the same right pane as Copilot.
  2. Ask Copilot to run a terminal command
  3. Note that focus switches to the terminal
  4. Note that focus never switches back to Copilot.
  5. Click back to Copilot. Note that the scroll bar is not all the way at the bottom.

This is really annoying because I have to keep manually clicking back to Copilot to see what it's doing.

Suggestions:

  1. Don't set focus to the terminal at all. I don't think it's necessary especially now that the terminal result is snippeted in chat.
  2. If you do set focus to the terminal, then set focus back to Copilot when the CLI command completes.

</issue_description>

Comments on the Issue (you are @copilot in this section)

@Tyriar We should not be opening the terminal if it's in the same view group as Chat.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix terminal focus issue in Copilot when in right pane Fix terminal focus steal when terminal and chat are in same view pane Jan 10, 2026
Copilot AI requested a review from meganrogge January 10, 2026 01:52
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.

Copilot setting focus to terminal ruins experience when terminal is also in right pane

2 participants