Skip to content

Commit f5379b1

Browse files
committed
More tweaks
1 parent ee6d6ba commit f5379b1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/processTargets/modifiers/scopeHandlers/OneOfScopeHandler.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default class OneOfScopeHandler implements ScopeHandler {
4343
throw new NotHierarchicalScopeError(this.scopeType);
4444
}
4545

46-
return keepOnlyTopLevelScopes(
46+
return keepOnlyBottomLevelScopes(
4747
this.scopeHandlers.flatMap((scopeHandler) =>
4848
scopeHandler.getScopesTouchingPosition(editor, position, ancestorIndex)
4949
)
@@ -100,3 +100,14 @@ function keepOnlyTopLevelScopes(candidateScopes: TargetScope[]): TargetScope[] {
100100
)
101101
);
102102
}
103+
104+
function keepOnlyBottomLevelScopes(
105+
candidateScopes: TargetScope[]
106+
): TargetScope[] {
107+
return candidateScopes.filter(
108+
({ domain }) =>
109+
!candidateScopes.some(({ domain: otherDomain }) =>
110+
domain.contains(otherDomain)
111+
)
112+
);
113+
}

0 commit comments

Comments
 (0)