( node: SyntaxNode, selection: SelectionWithEditor, nodeMatcher: NodeMatcher )
| 89 | } |
| 90 | |
| 91 | function iterateNearestIterableAncestor( |
| 92 | node: SyntaxNode, |
| 93 | selection: SelectionWithEditor, |
| 94 | nodeMatcher: NodeMatcher |
| 95 | ) { |
| 96 | let parent: SyntaxNode | null = node.parent; |
| 97 | while (parent != null) { |
| 98 | const matches = parent!.namedChildren |
| 99 | .flatMap((sibling) => nodeMatcher(selection, sibling)) |
| 100 | .filter((match) => match != null) as NodeMatcherValue[]; |
| 101 | if (matches.length > 0) { |
| 102 | return matches; |
| 103 | } |
| 104 | parent = parent.parent; |
| 105 | } |
| 106 | return []; |
| 107 | } |
no outgoing calls
no test coverage detected