Skip to content
Prev Previous commit
Next Next commit
Fix restart
  • Loading branch information
rchiodo committed Apr 13, 2020
commit 7d5a6dc3807590945ae4ff30986353b2233f1253
18 changes: 16 additions & 2 deletions src/client/datascience/editor-integration/codeLensFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import * as localize from '../../common/utils/localize';
import { noop } from '../../common/utils/misc';
import { generateCellRangesFromDocument, ICellRange } from '../cellFactory';
import { CodeLensCommands, Commands, Identifiers } from '../constants';
import { INotebookIdentity, InteractiveWindowMessages } from '../interactive-common/interactiveWindowTypes';
import {
INotebookIdentity,
InteractiveWindowMessages,
SysInfoReason
} from '../interactive-common/interactiveWindowTypes';
import {
ICell,
ICellHashProvider,
Expand Down Expand Up @@ -78,7 +82,6 @@ export class CodeLensFactory implements ICodeLensFactory, IInteractiveWindowList

case InteractiveWindowMessages.NotebookClose:
if (payload.resource.toString() === this.interactiveIdentity?.toString()) {
this.codeLensCache.clear();
this.interactiveIdentity = undefined;
this.hashProvider = undefined;
this.documentExecutionCounts.clear();
Expand All @@ -91,6 +94,17 @@ export class CodeLensFactory implements ICodeLensFactory, IInteractiveWindowList
this.initCellHashProvider();
break;

case InteractiveWindowMessages.AddedSysInfo:
if (payload && payload.type) {
const reason = payload.type as SysInfoReason;
if (reason !== SysInfoReason.Interrupt) {
this.documentExecutionCounts.clear();
// Clear out any goto cell code lenses.
this.updateEvent.fire();
}
}
break;

case InteractiveWindowMessages.FinishCell:
const cell = payload as ICell;
if (cell && cell.data && cell.data.execution_count) {
Expand Down