Skip to content

Commit

Permalink
Check for new Quarto version for R pkg support
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasilge authored and jjallaire committed May 30, 2024
1 parent f0d4538 commit 06678d5
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions apps/vscode/src/providers/preview/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ class PreviewManager {
}

private usesQuartoServeCommand(doc?: TextDocument) {
return isQuartoShinyKnitrDoc(this.engine_, doc) ||
(isQuartoShinyDoc(this.engine_, doc) && semver.lte(this.quartoContext_.version, "1.4.414"));
return isQuartoShinyKnitrDoc(this.engine_, doc) ||
(isQuartoShinyDoc(this.engine_, doc) && semver.lte(this.quartoContext_.version, "1.4.414"));
}

private previewRenderRequest(doc: TextDocument, format: string | null) {
Expand Down Expand Up @@ -414,7 +414,7 @@ class PreviewManager {
}

private async killPreview() {
await killTerminal(kPreviewWindowTitle, async () => await this.previewTerminateRequest());
await killTerminal(kPreviewWindowTitle, async () => await this.previewTerminateRequest());
this.progressDismiss();
this.progressCancellationToken_ = undefined;
}
Expand Down Expand Up @@ -466,7 +466,7 @@ class PreviewManager {

// create base terminal command
const cmd = terminalCommand(useServeCommand ? "serve" : "preview", this.quartoContext_, target);

// extra args for normal docs
if (!useServeCommand) {
if (!doc) {
Expand All @@ -483,8 +483,17 @@ class PreviewManager {

// use temp output-dir for R package
if (isRPackageWorkspace && this.previewRPackageDirConfig()) {
cmd.push("--output-dir", tmp.dirSync().name);
cmd.push("--embed-resources");
const rPkgRequiredVersion = "1.5.39";

This comment has been minimized.

Copy link
@mcanouil

mcanouil Jun 26, 2024

Contributor

@juliasilge Why is there a requirement to be using a pre-release version?
I don't think the VSCode extension should have requirement on pre-release.
Instead, for such thing a "preview" version of the extension would be preferable.

quarto-dev/quarto-cli#10143

This comment has been minimized.

Copy link
@juliasilge

juliasilge Jun 27, 2024

Author Collaborator

I definitely see your point and understand the annoyance of the original poster over on quarto-dev/quarto-cli#10143, yes. This was for support needed for how Quarto behaves inside of an R package, as we lean on Quarto for rendering documents heavily in Positron.

if (semver.gte(this.quartoContext_.version, rPkgRequiredVersion)) {
cmd.push("--output-dir", tmp.dirSync().name);
cmd.push("--embed-resources");
} else {
window.showWarningMessage(
`Rendering requires Quarto version ${rPkgRequiredVersion} or greater`,
{ modal: true }
);
return;
}
}

// send terminal command
Expand Down Expand Up @@ -698,7 +707,7 @@ class PreviewManager {
}

private zoomLevel(uri?: Uri) {
if (uri === undefined ||isHtmlContent(uri.toString())) {
if (uri === undefined || isHtmlContent(uri.toString())) {
return this.webviewManager_.getZoomLevelConfig();
} else {
return undefined;
Expand Down

0 comments on commit 06678d5

Please sign in to comment.