code: function findStartLine(cm, n, precise) {
    let minindent, minline, doc = cm.doc
    let lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100)
    for (let search = n; search > lim; --search) {
      if (search <= doc.first) return doc.first
      let line = getLine(doc, search - 1), after = line.stateAfter
      if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
        return search
      let indented = countColumn(line.text, null, cm.options.tabSize)
      if (minline == null || minindent > indented) {
        minline = search - 1
        minindent = indented
      }
    }
    return minline
  }
docs: Finds the line to start with when starting a parse. Tries to find a line with a stateAfter, so that it can start with a valid state. If that fails, it returns the line with the smallest indentation, which tends to need the least context to parse correctly.