Closed
Description
Not sure if oneOf
is the right name, but we should support a way to compose scope types like the following:
interface OneOfScopeType {
type: "oneOf";
scopeTypes: ScopeType[]
}
Then we can construct a OneOfScopeHandler
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 ofscopeTypes
touching positiongetScopesOverlappingRange
: callgetScopesOverlappingRange
on allscopeTypes
and then remove any scopes that are contained by another scopegetScopeRelativeToPosition
: pick first scope of any of thescopeTypes
, then skip it for offset > 1, etciterationScope
: applyoneOf
to the iteration scopes ofscopeTypes
Use cases
- Add a proper scope type for
"inside"
#1046 - Create a smarter iteration scope for "item" #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
oneOf
scope 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
cascading
union
oneOf
anyOf
or