highlightDefs()

in src/overlay/gather-markers.ts [314:328]


  highlightDefs(editor: CodeMirror.Editor, cell: py.Cell) {
    /**
     * Fetch the cell program instead of recomputing it, as it can stall the interface if we
     * analyze the code here.
     */
    let cellProgram = this._model.getCellProgram(cell);
    if (cellProgram !== null && !cellProgram.hasError) {
      for (let ref of cellProgram.defs) {
        if (ref.type == py.SymbolType.VARIABLE) {
          this._model.addEditorDef({ def: ref, editor: editor, cell: cell });
        }
      }
    }
    log("Highlighted definitions", { numActive: this._defMarkers.length });
  }