Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Commit

Permalink
Fix handling notebook cell closed
Browse files Browse the repository at this point in the history
  • Loading branch information
renkun-ken committed Aug 28, 2020
1 parent 681725f commit 1a159d4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,22 @@ export function activate(context: ExtensionContext) {

async function didCloseTextDocument(document: TextDocument) {
if (document.uri.scheme === 'untitled') {
return;
const result = workspace.textDocuments.find((doc) => doc.uri.scheme === 'untitled');
if (result) {
// Stop the langauge server when all untitled documents are closed.
return;
}
}

if (document.uri.scheme === 'vscode-notebook-cell') {
const result = workspace.textDocuments.find((doc) => doc.uri.fsPath === document.uri.fsPath);
if (result) {
// Stop the language server when all cell documents are closed (notebook closed).
return;
}
}

// Stop the language server when single file outside workspace is closed, or the above cases.
const key = getKey(document.uri);
let client = clients.get(key);
if (client) {
Expand Down

0 comments on commit 1a159d4

Please sign in to comment.