Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for new Quarto version for R pkg support #455

Merged
merged 1 commit into from
May 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";
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