This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
markClean()
afterclearHistory()
since the two are no longer tiedMore detail on the latter: The reason for #2335 was that the highlight worker doesn't kick in after an update until after a certain delay. This was exacerbated by a recent commit to CodeMirror that increases the delay. We submitted a patch to CodeMirror that adds a "precise" parameter, which ensures that when
getTokenAt()
is called, it ignores cached line states that haven't been refreshed yet during the current highlighting pass.Note that this doesn't absolutely guarantee precision, since
getTokenAt()
will look backwards a maximum of 100 lines to find a line with a known good state; if it doesn't find one, it will pick the line with the least indentation and assume that it can use the mode's default start state at the beginning of that line. But it should be a good enough heuristic.Also note that passing true for this parameter to
getTokenAt()
means that it will scan backward for a good line state farther than it originally did when run immediately after an edit. I think that performance tradeoff is fine for increased accuracy, and in most cases (like typing) it won't affect us that much because the last edit is on the current line.