Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#1,194 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Bondrewd-K đang làm issue này rồi.

Từ ngày 14/10/2026.

  • #1197 của @Bondrewd-K — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
powershell, typescript, vscode
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu từ apps/vscode/src/core/terminal.ts, nơi terminalCommand() bao đích trong shQuote(), sau đó đọc shQuote() trong packages/core/src/strings.ts, hàm này chỉ đặt dấu ngoặc kép khi giá trị có khoảng trắng. Tái tạo lỗi bằng cách truyền một đường dẫn có dấu ngoặc tròn và không có khoảng trắng, rồi kiểm tra chuỗi lệnh được tạo ra. Hoàn thành khi các đường dẫn như vậy được đặt trong dấu ngoặc kép, các đường dẫn có khoảng trắng và ký tự đặc biệt khác vẫn hoạt động, và có unit test bao phủ trường hợp dấu ngoặc tròn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
655
Fork
64
Merge trung bình
8 giờ 45 phút
Pull request đã merge (30 ngày)
36

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quarto-dev/quarto

Tất cả issue của quarto-dev/quarto

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.