Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 12, 2026

When a filter is active in the Output pane, copying (Ctrl+A + Ctrl+C) currently copies all content including hidden/filtered lines. This makes filtered logs difficult to process.

Changes

  • FilterController: Exposed getHiddenAreas() to surface currently hidden ranges
  • FilteredCopyHandler: New editor contribution that intercepts copy events and filters selection ranges line-by-line to exclude hidden areas
  • Clipboard integration: Uses ClipboardEventUtils for consistency with VS Code clipboard operations
  • Performance: Zero overhead when no filter is active (early return path)

Implementation Details

The handler splits selection ranges by iterating through lines and checking if each line falls within a hidden area. Visible sub-ranges are extracted and concatenated with proper EOL characters. When no filter is active, default copy behavior is preserved.

Resource management follows the established DisposableStore pattern used in FilterController. The copy listener is re-attached when the editor model changes.

Testing

Manual testing required: Apply filter in Output pane → select and copy content → verify only visible lines are copied to clipboard.

Original prompt

This section details on the original issue you should resolve

<issue_title>Copying Output pane with a filter should copy only visible logs</issue_title>
<issue_description>Currently, one can filter Output pane contents using a filter. But when I want to copy the contents, everything is copied.

It would be really really nice if copying of logs worked well to be able to effectively process logs.

</issue_description>

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


💡 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 AI and others added 7 commits January 12, 2026 19:47
- Add FilteredCopyHandler contribution to intercept copy events
- Filter copied text to exclude hidden areas when filter is active
- Expose hidden areas from FilterController
- Only applies filtering when there are hidden areas (filter active)

Co-authored-by: joaomoreno <[email protected]>
- Use line-by-line approach for better clarity
- Add isLineHidden helper method
- Simplify splitRangeByHiddenAreas implementation

Co-authored-by: joaomoreno <[email protected]>
The clipboardService was injected but not used since copy is handled
directly via ClipboardEvent's clipboardData property.

Co-authored-by: joaomoreno <[email protected]>
- Remove unused createModel function from test
- Add comment explaining manual listener lifecycle management
- Optimize getVisibleTextToCopy to avoid redundant hidden areas lookup
- Pass hiddenAreas as parameter instead of fetching twice

Co-authored-by: joaomoreno <[email protected]>
- Use ClipboardEventUtils.setTextData() for consistency with VS Code clipboard handling
- Use DisposableStore pattern for listener management (follows FilterController pattern)
- Fix getLineMaxColumn fallback to return early if model is null
- Remove custom dispose() override as it's now handled by DisposableStore

Co-authored-by: joaomoreno <[email protected]>
- Remove unused imports from test file (OutputEditor, TextModel, URI, ITextModel)
- Remove unused IDisposable import from outputView.ts
- Add comment explaining ClipboardStoredMetadata version number
- Extract column calculation helpers to reduce code duplication
- Add getStartColumn() and getEndColumn() helper methods

Co-authored-by: joaomoreno <[email protected]>
Copilot AI changed the title [WIP] Fix copying of visible logs from Output pane Fix: Copy in Output pane respects active filters Jan 12, 2026
Copilot AI requested a review from joaomoreno January 12, 2026 20:03
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.

Copying Output pane with a filter should copy only visible logs

2 participants