cursorless
cursorless copied to clipboard
Add new `anyOf` compound scope type
Not sure if anyOf is the right name, but we should support a way to compose scope types like the following:
interface AnyOfScopeType {
type: "anyOf";
scopeTypes: ScopeType[]
}
Then we can construct a AnyOfScopeHandler that will behave the same as a hierarchical scope where each scope can be any of scopeTypes. So basically:
getScopesTouchingPosition: return smallest scopes of any ofscopeTypestouching positiongetScopesOverlappingRange: callgetScopesOverlappingRangeon allscopeTypesand then remove any scopes that are contained by another scopegetScopeRelativeToPosition: pick first scope of any of thescopeTypes, then skip it for offset > 1, etcgetIterationScopesTouchingPosition: not sure. maybe call this on allscopeTypesand use the smallest iteration scope?
Use cases
- #1046
- #1047
- defining "name" as a union of "class name", "function name", etc
- to define iteration scope of surrounding pair to be union of "inside" and "file"
- users could map a custom scope type Talon side that constructs an
anyOfscope type to enable them to construct their own unions of other scope types - we could maybe map a spoken form
"<scope> or <scope>"to construct these on the fly, eg"take next funk or class"
Possible names
cascadingunionanyOfoneOfor