Make styled range store generic#323
Merged
thecoolwinter merged 7 commits intoCodeEditApp:mainfrom May 30, 2025
Merged
Conversation
0xWDG
approved these changes
May 29, 2025
tom-ludwig
approved these changes
May 29, 2025
Member
tom-ludwig
left a comment
There was a problem hiding this comment.
Looks great!
Generally, I try to avoid using Self for readability reasons, but since it’s already present in the existing files, it’s fine here.
austincondiff
approved these changes
May 29, 2025
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.
Description
This makes the
StyledRangeStoretype 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:
StyledRangeStoretoRangeStore, as well as all associated types.RangeStorea value type (struct) with copy-on-write semantics, allowing for it to be concurrency safe andSendable.RangeStorestore a new, generic,RangeStoreElementtype.StyledRangeContainerto use the updatedRangeStore, with a custom element type that stores captures and modifiers.StyledRangeContainerto use a raised version of thecombineLower[Higher]Prioritymethods 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.