Skip to content

Include rich Markdown selections in chat context - #340717

Merged
Henning Dieterichs (hediet) merged 2 commits into
mainfrom
hediet/custom-editor-chat-selection
Oct 9, 2026
Merged

Henning Dieterichs (hediet) merged 2 commits into
mainfrom
hediet/custom-editor-chat-selection

Conversation

@hediet

Copy link
Copy Markdown
Member

Use the custom-text-editor navigation infrastructure from #340695 to include rich Markdown selections as implicit chat context, including in the Agents window.

  • Attach the active panel's document URI and Markdown source range instead of a previously active code editor's selection.
  • Handle navigation readiness/removal, panel switching, and cleared selections without adding a renderer RPC or extension API.
  • Cancel superseded context updates and preserve existing context settings, ignored-file checks, and additional context providers.
  • Add regression tests and contributor documentation.

Validation: 27 targeted tests passed, including 8 new selection-context tests. Full client typecheck, changed-file lint, module layering, and commit hygiene passed.

Closes #326726

Reuse custom-editor navigation for per-panel source ranges, handle navigation readiness and removal, and cancel superseded context updates.

Fixes #326726

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 12:28

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.

🟡 Changes recommended

Refresh cancellation can leave existing widgets stale, and unthrottled editor events can flood context providers.

2 open findings
What changed in this PR

Adds rich Markdown selections to implicit chat context across the workbench and Agents window.

Changes:

  • Tracks custom-editor navigation and source selections.
  • Cancels superseded context updates and preserves provider context.
  • Adds regression tests and contributor documentation.
File Description
customEditorInput.ts Emits navigation lifecycle changes.
chatImplicitContext.ts Adds custom-editor selection context.
chatImplicitContext.test.ts Tests selection and lifecycle behavior.
CONTRIBUTING.md Documents Markdown chat context.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Debounce custom editor events together and refresh existing widgets when registration supersedes pending work. Cover both review findings with regression tests.

Co-authored-by: Copilot <[email protected]>
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.

Markdown editor context/selection is not added to chat

4 participants