This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
Don't construct placeholder tokenized lines - #12933
Merged
Merged
Conversation
as-cii
force-pushed
the
mb-remove-placeholder-tokenized-lines
branch
2 times, most recently
from
October 12, 2016 07:04
8e8341a to
d57b2df
Compare
Previously we were treating the local `NullGrammar` differently from `atom.grammars.nullGrammar`. These two grammars are conceptually the same, as the former was created to support editors creation without a grammar registry. To keep backwards-compatibility, we also build placeholder lines on-demand when calling `TokenizedBuffer.prototype.tokenizedLineForRow`. This ensure that packages relying on the internals of `TokenizedBuffer` to retrieve syntactic boundaries won't break when the null grammar is used or large file mode is on.
Since this method will now construct a placeholder line, we want to use it only where necessary to keep memory footprint to a minimum.
as-cii
force-pushed
the
mb-remove-placeholder-tokenized-lines
branch
from
October 12, 2016 07:04
d57b2df to
00f4c7b
Compare
as-cii
force-pushed
the
mb-remove-placeholder-tokenized-lines
branch
from
October 12, 2016 10:09
53464cb to
d3882c1
Compare
added 7 commits
October 12, 2016 12:10
Previously, for null grammar and large file mode, we were short circuiting the tokenization of the next chunk or the invalidation of a row. However, that is unnecessary because there is no additional chunk to process with null grammar or in large file mode.
as-cii
force-pushed
the
mb-remove-placeholder-tokenized-lines
branch
from
October 12, 2016 16:59
386d808 to
1f210ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
After merging #11414, we changed how we represent syntactic boundaries to use
TokenizedBufferIteratorinstead. This approach allows us to not build placeholder lines eagerly whenever there is a buffer change or when instantiating a newTokenizedBuffer.In reality, we still need to construct
TokenizedLineinstances whenTokenizedBuffer.prototype.tokenizedLineForRowis called because we want to construct some synthetic null grammar boundaries so thatTokenizedBufferIteratordoesn't iterate till the end of the buffer (regression), and also because other packages are currently relying on that API. In practice this should be pretty cheap, because in the majority of the cases it happens only for lines that are currently on screen.