fix: shell-escape generator-produced suggestion replacements#13917
fix: shell-escape generator-produced suggestion replacements#13917nickeddy wants to merge 1 commit into
Conversation
Suggestions produced by `Generator::script` (Rust generators registered via the command-signatures crate) and by v2 script generators flowed through `From<...::Suggestion> for Suggestion` impls that copied the raw value into `replacement` with no shell-escaping. Once the upstream command-signatures fix for `git add <tab>` lands, this gap becomes user-visible: selecting a suggestion for a path containing spaces inserts an unescaped string into the buffer, so the shell parses it as multiple tokens (`git add new file test.csv` instead of `git add new\ file\ test.csv`). Apply `ShellFamily::escape` after the `From` conversion in both the legacy (`engine/argument/legacy.rs`) and v2 (`engine/argument/v2.rs`) generator pipelines so generator-backed suggestions match the escaping behavior the path completer (`engine/path.rs`) already provides for filesystem-backed completions. Includes a failing-then-passing unit test for the legacy code path. A parallel v2 test is deferred because it would require introducing shared test infrastructure (TEST_GENERATOR_3 + JS callback wiring). Refs warpdotdev#11072, warpdotdev/command-signatures#271. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Every PR must be linked to a same-repo issue before Oz can review it. Next step: open or find a same-repo issue describing this change, then link it to this PR by adding See the contribution guidelines for the full readiness model. Powered by Oz |
There was a problem hiding this comment.
Every PR must be linked to a same-repo issue before Oz can review it.
Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-implement when it is ready. Once it is marked, comment /oz-review to re-trigger review.
See the contribution guidelines for the full readiness model.
Powered by Oz
Supersedes #11796, which was auto-closed when my fork was deleted (GitHub permanently closes a fork's PRs on fork deletion and they can't be reopened against a new fork). I didn't mean to close that - thought things were in a merged state. This is the same commit, rebased onto current
master.Suggestions produced by
Generator::script(Rust generators registered via the command-signatures crate) and by v2 script generators flowed throughFrom<...::Suggestion> for Suggestionimpls that copied the raw value intoreplacementwith no shell-escaping. Once the upstream command-signatures fix forgit add <tab>lands, this gap becomes user-visible: selecting a suggestion for a path containing spaces inserts an unescaped string into the buffer, so the shell parses it as multiple tokens (git add new file test.csvinstead ofgit add new\ file\ test.csv).Apply
ShellFamily::escapeafter theFromconversion in both the legacy (engine/argument/legacy.rs) and v2 (engine/argument/v2.rs) generator pipelines so generator-backed suggestions match the escaping behavior the path completer (engine/path.rs) already provides for filesystem-backed completions.Closes #11072
Refs #11072, warpdotdev/command-signatures#271.
Description
Linked Issue
ready-to-specorready-to-implement.Testing
./script/runScreenshots / Videos
Current behavior:

After fixes:

Agent Mode
BUG-FIX: shell-escape generator-produced suggestion replacements