Skip to content

feat: Enhance command handling and completion for runtime commands#322976

Merged
DonJayamanne merged 2 commits into
mainfrom
don/moderate-guineafowl
Jun 25, 2026
Merged

feat: Enhance command handling and completion for runtime commands#322976
DonJayamanne merged 2 commits into
mainfrom
don/moderate-guineafowl

Conversation

@DonJayamanne

Copy link
Copy Markdown
Contributor
  • Updated MockCopilotSession to include aliases and input hints for commands.
  • Modified command invocation logic to support trailing text as input for commands like /env and /review.
  • Improved slash command parsing to retain raw input for better handling of multiline commands.
  • Enhanced completion provider to include runtime command descriptions and hints in completion items.
  • Added tests for new command behaviors and completion scenarios, ensuring robust handling of runtime commands.
  • Updated AgentHostInputCompletionHandler to provide detailed command descriptions in completion suggestions.

- Updated `MockCopilotSession` to include aliases and input hints for commands.
- Modified command invocation logic to support trailing text as input for commands like `/env` and `/review`.
- Improved slash command parsing to retain raw input for better handling of multiline commands.
- Enhanced completion provider to include runtime command descriptions and hints in completion items.
- Added tests for new command behaviors and completion scenarios, ensuring robust handling of runtime commands.
- Updated `AgentHostInputCompletionHandler` to provide detailed command descriptions in completion suggestions.
Copilot AI review requested due to automatic review settings June 25, 2026 16:24
@DonJayamanne DonJayamanne self-assigned this Jun 25, 2026

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.

Pull request overview

This PR enhances Copilot CLI runtime slash-command handling end-to-end in the agent host: it broadens slash-command parsing (including preserving raw trailing input), routes more commands through the runtime commands API (with alias + input forwarding), and improves completion items to surface richer command metadata.

Changes:

  • Extend slash-command parsing to accept arbitrary /token commands and preserve both trimmed rest and untrimmed rawRest (including multiline).
  • Fetch and cache a runtime command catalog (names + aliases + input hints), use it for both invocation routing and completion suggestions.
  • Improve UI-side completion rendering to show descriptions in the label/documentation, and add/update unit tests for the new behaviors.
Show a summary per file
File Description
src/vs/sessions/contrib/chat/browser/agentHostInputCompletions.ts Enriches command completion items with label descriptions and documentation derived from attachment metadata.
src/vs/platform/agentHost/test/node/copilotSlashCommandCompletionProvider.test.ts Updates parsing + completion tests for arbitrary tokens, rawRest preservation, aliases, and hinted completions.
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts Adds coverage for forwarding trailing input to runtime commands and runtime-command vs. fallback send behavior.
src/vs/platform/agentHost/node/copilot/copilotSlashCommandCompletionProvider.ts Switches completion source to runtime command listing (including aliases/hints) and broadens slash-command parsing.
src/vs/platform/agentHost/node/copilot/copilotSessionWrapper.ts Exposes a new commands.changed SDK event to support invalidating cached runtime command metadata.
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Routes more slash commands via runtime commands.invoke, forwards raw input, and replaces TTL-based cache with event-driven invalidation.
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Wires runtime command listing into the completion provider and introduces a wait timeout parameter for command discovery.

Copilot's findings

  • Files reviewed: 7/7 changed files
  • Comments generated: 5

Comment thread src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts
Comment thread src/vs/platform/agentHost/node/copilot/copilotAgent.ts
@DonJayamanne DonJayamanne marked this pull request as ready for review June 25, 2026 20:38
@DonJayamanne DonJayamanne enabled auto-merge (squash) June 25, 2026 20:38
@DonJayamanne DonJayamanne merged commit 0f1b95c into main Jun 25, 2026
46 of 47 checks passed
@DonJayamanne DonJayamanne deleted the don/moderate-guineafowl branch June 25, 2026 20:43
@vs-code-engineering vs-code-engineering Bot added this to the 1.127.0 milestone Jun 25, 2026
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.

3 participants