Repository navigation
fix(syntax): cache scope tables by source, and forget answered keys - #108
Merged
Merged
Conversation
The scope worker cached tables by request key and language alone, so a key asked again for another source, or the same key from another client, got the first source's table: hunk headers could name scopes from a different text. It also kept the newest generation of every key ever asked until its client went away, and each revision brings new keys. Tables are now cached by a hash and length of the source with its language, which is all a table depends on. A key's entry goes once its newest request is answered; a client asks for a key in order, so no older generation can follow it.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hunk headers could show enclosing scopes from a different text, because the scope worker cached tables by request key and language only, so a key reused for new source (or the same key from another client) got the first source's table; it also kept an entry for every key ever requested until its client was dropped. Tables are now cached by a hash and length of the source plus its language, and a key's entry is dropped once its newest request is answered.