in src/overlay/gather-markers.ts [345:378]
highlightDependencies(slice: py.SlicedExecution) {
let defLines: number[] = [];
slice.cellSlices.forEach(cellSlice => {
let loggedCell = cellSlice.cell;
let sliceLocations = cellSlice.slice;
let liveCellWidget = this._elementFinder.getCellWidget(loggedCell);
let editor = this._elementFinder.getEditor(loggedCell);
if (liveCellWidget && editor) {
let liveCell = new LabCell(liveCellWidget.model as ICodeCellModel);
let numLines = 0;
// Batch the highlight operations for each cell to spend less time updating cell height.
editor.operation(() => {
sliceLocations.items.forEach((loc: py.Location) => {
for (
let lineNumber = loc.first_line - 1;
lineNumber <= loc.last_line - 1;
lineNumber++
) {
numLines += 1;
let styleClass = liveCell.dirty ? DIRTY_DEPENDENCY_CLASS : DEPENDENCY_CLASS;
let lineHandle = editor.addLineClass(lineNumber, "background", styleClass);
this._dependencyLineMarkers.push({
editor: editor,
lineHandle: lineHandle
});
}
});
defLines.push(numLines);
});
}
});
log("Added lines for defs (may be overlapping)", { defLines });
}