VSCode Extension: Preview opens wrong file when started from subdirectory in Cursor IDE

Open
#891 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript, vscode
Domain
tooling

Research direction

Reproduce the issue with the linked fub-letter example repository by opening english/template.qmd in Cursor and triggering Quarto preview. Locate the VS Code extension entry point for the preview command and inspect how the active file and workspace directory are selected; done means the opened subdirectory file is previewed instead of the root file.

Written by the indexing model from the issue text.

Description

Bug Description

When opening a .qmd file in a subdirectory and triggering Quarto preview in Cursor IDE, the preview renders a different file from the project root instead of the opened file.

Steps to Reproduce

  1. Have a Quarto project with subdirectories containing .qmd files:
    project/
    ├── template.qmd
    ├── english/
    │   └── template.qmd
    └── german/
        └── template.qmd
    
  2. Open english/template.qmd in Cursor IDE
  3. Trigger Quarto preview (Cmd+Shift+K or preview button)
  4. Observe that project/template.qmd is previewed instead of english/template.qmd

Expected Behavior

Preview should render the currently opened file (english/template.qmd)

Actual Behavior

Preview renders the root template.qmd file instead, ignoring which file is actually open in the editor

Environment

  • Cursor IDE version: 2.3.41 (fork of VS Code)
  • Quarto extension version: 1.128.0
  • Quarto CLI version: 1.8.26
  • OS: macOS 26.2 (Sequoia)

Workaround

Running quarto preview template.qmd from command line in the subdirectory works correctly, so this appears to be an IDE extension issue rather than a Quarto CLI bug.

Additional Context

  • The issue occurs consistently regardless of which subdirectory file is opened
  • The preview always defaults to the root template.qmd file
  • This makes it impossible to preview subdirectory-specific templates from within Cursor IDE
  • Cursor IDE is based on VS Code, so this may affect VS Code as well

Related Issues

  • Possibly related to working directory resolution in the VS Code extension
  • Similar behavior seen in quarto-dev/quarto-cli#7049 (Quarto processes several files when previewing one)

Example Repository

Can be reproduced with: https://github.com/michaelaye/fub-letter

Dominant language
TypeScript
Stars
645
Forks
62
Avg merge
17h 42m
Merged PRs (30d)
13

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quarto-dev/quarto

All issues in quarto-dev/quarto

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.