MCPcopy Create free account
hub / github.com/REditorSupport/vscode-R / updatePreview

Method updatePreview

src/rmarkdown/preview.ts:288–309  ·  view source on GitHub ↗
(preview?: RMarkdownPreview)

Source from the content-addressed store, hash-verified

286 }
287
288 public async updatePreview(preview?: RMarkdownPreview): Promise<void> {
289 const toUpdate = preview ?? this.activePreview.preview;
290 const previewUri = toUpdate ? this.previewStore.getFilePath(toUpdate) : undefined;
291 toUpdate?.cp?.dispose();
292
293 if (toUpdate && previewUri) {
294 toUpdate.isRendering = true;
295 const childProcess: DisposableProcess | void = await this.previewDocument(previewUri, toUpdate.title).catch(() => {
296 void vscode.window.showErrorMessage('There was an error in knitting the document. Please check the R Markdown output stream.');
297 this.rMarkdownOutput.show(true);
298 this.previewStore.delete(previewUri);
299 });
300
301 if (childProcess) {
302 toUpdate.cp = childProcess;
303 }
304
305 this.refreshPanel(toUpdate);
306 toUpdate.isRendering = false;
307 }
308
309 }
310
311 private async previewDocument(filePath: string, fileName?: string, viewer?: vscode.ViewColumn, currentViewColumn?: vscode.ViewColumn): Promise<DisposableProcess | undefined> {
312 const knitWorkingDir = this.getKnitDir(knitDir, filePath);

Callers 3

activateFunction · 0.80
startFileWatcherMethod · 0.80
setKnitDirMethod · 0.80

Calls 6

previewDocumentMethod · 0.95
refreshPanelMethod · 0.95
getFilePathMethod · 0.80
showMethod · 0.80
deleteMethod · 0.80
disposeMethod · 0.65

Tested by

no test coverage detected