Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 16, 2025

Implements the ability to Ctrl+click on comments in the Comments view to open the file at the comment location and collapse all comment threads in that editor, providing a quick way to navigate to code while minimizing visual clutter from expanded comments.

Changes

This PR adds new functionality to the Comments view tree interaction:

  • Regular click (existing behavior): Opens file and expands/reveals the specific comment thread
  • Ctrl+click (new behavior): Opens file and collapses ALL comment threads in that editor

Implementation Details

The implementation enhances the existing onDidOpen event handler in CommentsView to:

  1. Detect Ctrl+click events by checking browserEvent.ctrlKey
  2. Pass collapse intent to the openFile method via a new optional parameter
  3. Collapse comments after opening by getting the active editor's CommentController and calling collapseAll()
  4. Handle diff editors by selecting the appropriate side (modified or original)
  5. Use timing safeguards with a 100ms timeout to ensure the editor is fully loaded

Usage Example

When working with multiple comment threads in a file:

  1. Open the Comments view (View → Comments)
  2. Regular click on any comment → file opens with that comment expanded
  3. Ctrl+click on any comment → file opens with all comments collapsed

This is particularly useful when reviewing code with many comment threads, allowing developers to quickly navigate to specific locations while keeping the editor view clean and focused.

Testing

  • Added unit test to verify both regular click and Ctrl+click behavior
  • Passes CodeQL security analysis
  • Maintains full backward compatibility with existing functionality
  • Handles edge cases (no active editor, diff editors, missing controllers)

Fixes #XXXXX

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • electronjs.org
    • Triggering command: node-gyp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Fixes #266727


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Ctrl+click to Collaps all discuss thread in editor Add Ctrl+click to collapse all comment threads in editor from Comments view Sep 16, 2025
@Copilot Copilot AI requested a review from alexr00 September 16, 2025 16:59
Copilot finished work on behalf of alexr00 September 16, 2025 16:59
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.

Ctrl+click to Collaps all discuss thread in editor
2 participants