Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

VS Code extension: `quarto preview` fails when the file path contains parentheses (path not shell-quoted)

已关闭 适合新手
#1,194 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Bondrewd-K 已经在做这个了。

开始于 2026年10月14日。

  • #1197 来自 @Bondrewd-K —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
powershell, typescript, vscode
领域
devtools

调研方向

从 apps/vscode/src/core/terminal.ts 开始,其中 terminalCommand() 用 shQuote() 包裹目标,然后阅读 shQuote(),它位于 packages/core/src/strings.ts 中,只在值包含空白字符时才使用双引号。通过传入一个包含圆括号且不含空格的路径进行复现,并检查生成的命令字符串。完成的标准是:此类路径会被加上引号,包含空格及其他元字符的路径仍能正常工作,并且有单元测试覆盖圆括号的情况。

由索引模型根据 Issue 内容生成。

描述

bug vscode

Bug
Previewing a file whose path contains parentheses but no spaces
(e.g. C:\...\Article(md)\doc.qmd) makes the extension emit:

quarto preview C:/.../Article(md)/doc.qmd --no-browser --no-watch-inputs

PowerShell parses (md) as a subexpression — md is the mkdir alias — so
the terminal stalls at:

cmdlet mkdir at command pipeline position 1
Supply values for the following parameters:
Path[0]:

Repro

  1. Windows, integrated terminal = PowerShell.
  2. Open a doc under a parens-containing, space-free directory.
  3. Quarto: Preview → hangs at the Path[0]: prompt, preview never starts.

Expected
Quote the path:

quarto preview "C:/.../Article(md)/doc.qmd" --no-browser --no-watch-inputs

Root cause

  • preview.ts builds the command via terminalCommand("preview", ctx, target);
    sendTerminalCommand() joins it with spaces straight into the terminal.
  • terminalCommand() (apps/vscode/src/core/terminal.ts) wraps the target in
    shQuote().
  • shQuote() (packages/core/src/strings.ts) only double-quotes on whitespace
    (/\s/). Parentheses — and other metacharacters like &, ;, $ —
    without whitespace pass through unquoted. Broken in PowerShell; equally
    broken in bash, where bare parens are a syntax error.

Suggested fix
Quote when the value contains any shell metacharacter, or simply always
double-quote the path.

Workaround
Set the workspace default terminal to Command Prompt, or invoke quarto
manually with a quoted path.

主要语言
TypeScript
星标
655
派生
64
平均合并
20 小时 53 分钟
30 天内合并 PR
46

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

quarto-dev/quarto 的其他 Issue

查看 quarto-dev/quarto 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。