MCPcopy
hub / github.com/hokein/electron-sample-apps / findStartLine

Function findStartLine

mini-code-editor/cm/lib/codemirror.js:1775–1788  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

1773 // smallest indentation, which tends to need the least context to
1774 // parse correctly.
1775 function findStartLine(n) {
1776 var minindent, minline;
1777 for (var search = n, lim = n - 40; search > lim; --search) {
1778 if (search == 0) return 0;
1779 var line = getLine(search-1);
1780 if (line.stateAfter) return search;
1781 var indented = line.indentation(options.tabSize);
1782 if (minline == null || minindent > indented) {
1783 minline = search - 1;
1784 minindent = indented;
1785 }
1786 }
1787 return minline;
1788 }
1789 function getStateBefore(n) {
1790 var start = findStartLine(n), state = start && getLine(start-1).stateAfter;
1791 if (!state) state = startState(mode);

Callers 2

getStateBeforeFunction · 0.85
highlightWorkerFunction · 0.85

Calls 1

getLineFunction · 0.85

Tested by

no test coverage detected