File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ export function activate(context: ExtensionContext) {
36
36
vscode . commands . executeCommand ( worksheet . worksheetEvaluateAfterSaveKey )
37
37
}
38
38
} )
39
+ vscode . workspace . onDidCloseTextDocument ( document => {
40
+ if ( worksheet . isWorksheet ( document ) ) {
41
+ worksheet . removeWorksheet ( document )
42
+ }
43
+ } )
39
44
40
45
vscode . commands . registerCommand ( worksheet . worksheetEvaluateAfterSaveKey , ( ) => {
41
46
worksheet . evaluateCommand ( )
Original file line number Diff line number Diff line change @@ -55,6 +55,11 @@ export const worksheetEvaluateAfterSaveKey = "worksheet.evaluateAfterSave"
55
55
*/
56
56
export const worksheetCancelEvaluationKey = "worksheet.cancel"
57
57
58
+ /** Remove the worksheet corresponding to the given document. */
59
+ export function removeWorksheet ( document : vscode . TextDocument ) {
60
+ worksheets . delete ( document )
61
+ }
62
+
58
63
/** Is this document a worksheet? */
59
64
export function isWorksheet ( document : vscode . TextDocument ) : boolean {
60
65
return document . fileName . endsWith ( ".sc" )
You can’t perform that action at this time.
0 commit comments