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

Method startFileWatcher

src/rmarkdown/preview.ts:62–73  ·  view source on GitHub ↗
(RMarkdownPreviewManager: RMarkdownPreviewManager, filePath: string)

Source from the content-addressed store, hash-verified

60 }
61
62 private startFileWatcher(RMarkdownPreviewManager: RMarkdownPreviewManager, filePath: string) {
63 let fsTimeout: NodeJS.Timeout | null;
64 const fileWatcher = fs.watch(filePath, {}, () => {
65 const mtime = fs.statSync(filePath).mtime.getTime();
66 if (this.autoRefresh && !this.isRendering && !fsTimeout && mtime !== this.mtime) {
67 fsTimeout = setTimeout(() => { fsTimeout = null; }, 1000);
68 this.mtime = mtime;
69 void RMarkdownPreviewManager.updatePreview(this);
70 }
71 });
72 this.fileWatcher = fileWatcher;
73 }
74
75 private getHtmlContent(htmlContent: string): void {
76 let content = htmlContent.replace(/<(\w+)\s+(href|src)="(?!(\w+:)|#)/g,

Callers 1

constructorMethod · 0.95

Calls 1

updatePreviewMethod · 0.80

Tested by

no test coverage detected