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

Method didCloseTextDocument

src/languageService.ts:267–293  ·  view source on GitHub ↗
(document: TextDocument)

Source from the content-addressed store, hash-verified

265 };
266
267 const didCloseTextDocument = (document: TextDocument): void => {
268 if (document.uri.scheme === 'untitled') {
269 const result = workspace.textDocuments.find((doc) => doc.uri.scheme === 'untitled');
270 if (result) {
271 // Stop the language server when all untitled documents are closed.
272 return;
273 }
274 }
275
276 if (document.uri.scheme === 'vscode-notebook-cell') {
277 const result = workspace.textDocuments.find((doc) =>
278 doc.uri.scheme === document.uri.scheme && doc.uri.fsPath === document.uri.fsPath);
279 if (result) {
280 // Stop the language server when all cell documents are closed (notebook closed).
281 return;
282 }
283 }
284
285 // Stop the language server when single file outside workspace is closed, or the above cases.
286 const key = this.getKey(document.uri);
287 const client = this.clients.get(key);
288 if (client) {
289 this.clients.delete(key);
290 this.initSet.delete(key);
291 void client.stop();
292 }
293 };
294
295 workspace.onDidOpenTextDocument(didOpenTextDocument);
296 workspace.onDidCloseTextDocument(didCloseTextDocument);

Callers

nothing calls this directly

Calls 3

getKeyMethod · 0.95
deleteMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected