You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Description
This makes the `StyledRangeStore` type generic and `Sendable`. 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:
- Renamed `StyledRangeStore` to `RangeStore`, as well as all associated
types.
- Made `RangeStore` a value type (struct) with copy-on-write semantics,
allowing for it to be concurrency safe and `Sendable`.
> This doesn't have any effect on performance with the existing
highlighter code. The highlighter code modifies the storage objects it
uses in-place, so there is no copying necessary, only mutating.
- Made `RangeStore` store a new, generic, `RangeStoreElement` type.
- Updated `StyledRangeContainer` to use the updated `RangeStore`, with a
custom element type that stores captures and modifiers.
- Updated `StyledRangeContainer` to use a raised version of the
`combineLower[Higher]Priority` methods only where they're relevant
(instead of the requirement being on `RangeStoreElement`).
- Updated relevant tests.
### Related Issues
* CodeEditApp#43
### Checklist
- [x] I read and understood the [contributing
guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md)
as well as the [code of
conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code
### Screenshots
No behavior changes. This is in prep for CodeEditApp#43, but also lays the
groundwork for other features using a type like this.
Copy file name to clipboardExpand all lines: Sources/CodeEditSourceEditor/Highlighting/StyledRangeContainer/StyledRangeStore/StyledRangeStore+OffsetMetric.swift
0 commit comments