MCPcopy Index your code
hub / github.com/REditorSupport/vscode-R / updateSessionWatcher

Function updateSessionWatcher

src/session.ts:146–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144}
145
146function updateSessionWatcher() {
147 console.info(`[updateSessionWatcher] PID: ${pid}`);
148 console.info('[updateSessionWatcher] Create workspaceWatcher');
149 workspaceFile = path.join(sessionDir, 'workspace.json');
150 workspaceLockFile = path.join(sessionDir, 'workspace.lock');
151 workspaceTimeStamp = 0;
152 if (workspaceWatcher !== undefined) {
153 workspaceWatcher.close();
154 }
155 if (fs.existsSync(workspaceLockFile)) {
156 workspaceWatcher = fs.watch(workspaceLockFile, {}, () => {
157 void updateWorkspace();
158 });
159 void updateWorkspace();
160 } else {
161 console.info('[updateSessionWatcher] workspaceLockFile not found');
162 }
163
164 console.info('[updateSessionWatcher] Create plotWatcher');
165 plotFile = path.join(sessionDir, 'plot.png');
166 plotLockFile = path.join(sessionDir, 'plot.lock');
167 plotTimeStamp = 0;
168 if (plotWatcher !== undefined) {
169 plotWatcher.close();
170 }
171 if (fs.existsSync(plotLockFile)) {
172 plotWatcher = fs.watch(plotLockFile, {}, () => {
173 void updatePlot();
174 });
175 void updatePlot();
176 } else {
177 console.info('[updateSessionWatcher] plotLockFile not found');
178 }
179 console.info('[updateSessionWatcher] Done');
180}
181
182async function updatePlot() {
183 console.info(`[updatePlot] ${plotFile}`);

Callers 1

updateRequestFunction · 0.85

Calls 2

updateWorkspaceFunction · 0.85
updatePlotFunction · 0.70

Tested by

no test coverage detected