Make styled range store generic #323
Merged
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.
Description
This makes the
StyledRangeStore
type generic andSendable
. This type was originally created for storing relative ranges of highlight values (captures and modifiers). It excels at storing values for subranges of data even for large documents. I'm hoping to make this type a generic type we can use in other places in the package, like code folding, to store document state that needs to be maintained in lock-step with the document's real contents.Detailed changes:
StyledRangeStore
toRangeStore
, as well as all associated types.RangeStore
a value type (struct) with copy-on-write semantics, allowing for it to be concurrency safe andSendable
.RangeStore
store a new, generic,RangeStoreElement
type.StyledRangeContainer
to use the updatedRangeStore
, with a custom element type that stores captures and modifiers.StyledRangeContainer
to use a raised version of thecombineLower[Higher]Priority
methods only where they're relevant (instead of the requirement being onRangeStoreElement
).Related Issues
Checklist
Screenshots
No behavior changes. This is in prep for #43, but also lays the groundwork for other features using a type like this.