fix: detect Quarto engines from file content when quarto inspect is u…#4128
fix: detect Quarto engines from file content when quarto inspect is u…#4128zackverham wants to merge 1 commit into
Conversation
…navailable (#3993) When `quarto inspect` fails (e.g. quarto not in PATH) or returns empty engines for a directory inspection, the fallback path for .qmd files did not detect R/Python code chunks — resulting in an empty engines field in the manifest. Connect uses this field to decide whether to restore renv, so empty engines caused renv restore to be skipped. Now the fallback scans .qmd file content for `{r}` and `{python}` code chunks and sets engines to ["knitr"] / ["jupyter"] accordingly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @zackverham's task in 1m 14s —— View job Code Review Complete
SummaryThis PR fixes issue #3993 where Changes:
Review: ✅ ApprovedThe implementation is well-structured and addresses the issue correctly. What's good:
Code correctness verified:
Test coverage:
Minor Suggestions (non-blocking)
Verdict: This is a solid, well-tested fix. The implementation correctly addresses both scenarios: (1) when |
Summary
Fixes #3993 — Quarto documents with R code chunks (e.g.
source("script.R")) were generating an emptyenginesfield in the manifest, causing Connect to skip renv restore.Root cause: Two gaps in engine detection:
When
quarto inspectfails (quarto not in the extension host's PATH), the fallback path handled.ipynb→engines: ["jupyter"]and.Rmd→engines: ["knitr"], but for.qmdfiles it never read the file content to detect{r}or{python}code chunks — leaving engines empty.When
quarto inspectsucceeds on a directory but returns an emptyenginesarray (edge case with certain quarto configurations), the code skipped file-content language detection entirely.Fix: In both paths, scan
.qmdfile content using the existingdetectMarkdownLanguagesInContenthelper to identify code chunks and populate engines accordingly.Test plan
.qmdwith{r}chunks →engines: ["knitr"].qmdwith{python}chunks →engines: ["jupyter"].qmdwithsource("script.R")from Positron without quarto in PATH — verify TOML config getsengines = ["knitr"]🤖 Generated with Claude Code