Skip to content

Conversation

B44ken
Copy link

@B44ken B44ken commented Oct 7, 2025

see #270150

a "proper" fix would be introducing tree-sitter but this is straightforward and fixes the motivating example below

curl 'https://example.com/api?bool&detail=7&other=3' '{"key1":"value1","key2":"value2"}'

@Copilot Copilot AI review requested due to automatic review settings October 7, 2025 13:32
Copy link
Contributor

@Copilot Copilot AI left a comment

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 fixes quote parsing in subCommands.ts to properly handle shell commands containing quoted strings with special characters. The implementation introduces proper quote-aware parsing to prevent incorrect command splitting when quotes are present.

  • Replaces simple string splitting with a character-by-character parser that respects quoted strings
  • Adds support for backslash escaping and nested subshell extraction
  • Updates test cases to cover realistic scenarios including curl commands with quoted URLs and JSON data

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.ts Implements quote-aware parsing logic with escape handling and subshell extraction
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/subCommands.test.ts Adds comprehensive test cases for subshells and realistic curl command scenarios

@B44ken

This comment was marked as resolved.

@jere-mie
Copy link

jere-mie commented Oct 7, 2025

LGTM 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants