Fix preview of single-file Julia documents#14210
Merged
gordonwoodhull merged 2 commits intomainfrom Mar 13, 2026
Merged
Conversation
…ulia engine Engine extensions (like the bundled Julia engine) were only loaded in singleFileProjectContext when renderOptions was provided. The preview command creates the project context before render services exist, so engine extensions were never discovered for single files. This caused Jupyter to win the language claim for Julia code blocks. Now engine extensions are always resolved, using a fresh extension context as fallback when renderOptions is absent — matching the pattern used by projectContext. Fixes #14208
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Collaborator
|
The fix looks correct to me — I arrived at the same approach independently. For testing, since preview is hard to test end-to-end, a unit test on // tests/unit/project/single-file-engine-resolution.test.ts
import { unitTest } from "../../test.ts";
import { assert } from "testing/asserts";
import { join } from "../../../src/deno_ral/path.ts";
import { singleFileProjectContext } from "../../../src/project/types/single-file/single-file.ts";
import { notebookContext } from "../../../src/render/notebook/notebook-context.ts";
import { initYamlIntelligenceResourcesFromFilesystem } from "../../../src/core/schema/utils.ts";
unitTest(
"singleFileProjectContext resolves engine extensions without renderOptions",
async () => {
await initYamlIntelligenceResourcesFromFilesystem();
const tmpDir = Deno.makeTempDirSync({ prefix: "quarto-test" });
const file = join(tmpDir, "test.qmd");
Deno.writeTextFileSync(
file,
"---\ntitle: test\nengine: julia\n---\n",
);
try {
const nbContext = notebookContext();
const project = await singleFileProjectContext(file, nbContext);
assert(
project.config !== undefined,
"config should be initialized even without renderOptions",
);
assert(
Array.isArray(project.config?.engines) &&
project.config.engines.length > 0,
"engine extensions should be resolved (bundled engines discovered)",
);
} finally {
Deno.removeSync(tmpDir, { recursive: true });
}
},
);This fails before the fix ( |
…derOptions Verifies that singleFileProjectContext discovers bundled engine extensions (e.g. Julia) even when called without renderOptions, which is the code path used by quarto preview. Co-authored-by: Christophe Dervieux <cderv@users.noreply.github.com>
Contributor
Author
|
Thanks @cderv, added. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Engine extensions (like the bundled Julia engine) were only loaded in singleFileProjectContext when renderOptions was provided. The preview command creates the project context before render services exist, so engine extensions were never discovered for single files. This caused Jupyter to win the language claim for Julia code blocks.
Now engine extensions are always resolved, using a fresh extension context as fallback when renderOptions is absent — matching the pattern used by projectContext.
Fixes #14208