Skip to content

Debugger: support command + file launch config with program fallback and default file behavior#4051

Open
Copilot wants to merge 1 commit intomainfrom
copilot/fix-debugger-file-path-spaces-again
Open

Debugger: support command + file launch config with program fallback and default file behavior#4051
Copilot wants to merge 1 commit intomainfrom
copilot/fix-debugger-file-path-spaces-again

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 8, 2026

Motivation

Debugger launch fails when workspace/file paths contain spaces because the previous default config built a single unquoted program string (for example, ruby ${file}), which gets split by the shell.
This change addresses that path-tokenization failure while preserving compatibility with existing program-based launch configs.

Implementation

  • Config shape update (Option B)

    • Added first-class command + file launch configuration support.
    • Kept program as a backward-compatible fallback.
  • Defaulting behavior

    • file now defaults to ${file} during config resolution when:
      • command is present
      • program is absent
      • file is omitted
    • This keeps script configs minimal while allowing explicit ${relativeFile} where needed.
  • Generated debugger templates/docs

    • Debug script now emits only:
      { "type": "ruby_lsp", "name": "Debug script", "request": "launch", "command": "ruby" }
    • Debug test emits explicit relative file:
      {
        "type": "ruby_lsp",
        "name": "Debug test",
        "request": "launch",
        "command": "ruby -Itest",
        "file": "${relativeFile}"
      }
  • Launch command construction hardening

    • When using command + file, the extension constructs program with quoting/escaping for the file argument.
    • Added input guards to reject newline/null-byte content in command/file before shell execution.

Automated Tests

Updated debugger unit/integration tests to:

  • assert new default config output (command-first shape),
  • assert file defaults to ${file} when omitted,
  • exercise launch flow with a temp path containing spaces.

Manual Tests

  1. Open a project in a path containing spaces.
  2. Generate launch.json via “Debug: Add configuration...”.
  3. Run Debug script:
    • verify config can omit file and still launches current file.
  4. Run Debug test:
    • verify explicit ${relativeFile} flow still launches correctly.
  5. Confirm an older config using:
    { "type": "ruby_lsp", "request": "launch", "program": "ruby ${file}" }
    still resolves through the legacy program path.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node ./out/test/runTest.js --grep Debugger (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./out/test/runTest.js --grep Debugger (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix debugger fails when file path contains spaces Debugger: support command + file launch config with program fallback and default file behavior Apr 8, 2026
Copilot AI requested a review from rafaelfranca April 8, 2026 13:16
@rafaelfranca rafaelfranca force-pushed the copilot/fix-debugger-file-path-spaces-again branch from 6b91f2e to f8af8f7 Compare April 8, 2026 13:38
@rafaelfranca rafaelfranca added bugfix This PR will fix an existing bug vscode This pull request should be included in the VS Code extension's release notes labels Apr 8, 2026
@rafaelfranca rafaelfranca force-pushed the copilot/fix-debugger-file-path-spaces-again branch from f8af8f7 to 273d920 Compare April 8, 2026 13:42
@rafaelfranca rafaelfranca marked this pull request as ready for review April 8, 2026 13:42
@rafaelfranca rafaelfranca requested a review from a team as a code owner April 8, 2026 13:42
@rafaelfranca rafaelfranca removed their request for review April 8, 2026 13:42
@rafaelfranca rafaelfranca force-pushed the copilot/fix-debugger-file-path-spaces-again branch from 273d920 to 2bd8754 Compare April 8, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This PR will fix an existing bug vscode This pull request should be included in the VS Code extension's release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debugger fails when file path contains spaces (all platforms)

3 participants