( finder: NodeFinder, selector: SelectionExtractor = simpleSelectionExtractor )
| 22 | } from "./nodeFinders"; |
| 23 | |
| 24 | export function matcher( |
| 25 | finder: NodeFinder, |
| 26 | selector: SelectionExtractor = simpleSelectionExtractor |
| 27 | ): NodeMatcher { |
| 28 | return function (selection: SelectionWithEditor, node: SyntaxNode) { |
| 29 | const targetNode = finder(node, selection.selection); |
| 30 | return targetNode != null |
| 31 | ? [ |
| 32 | { |
| 33 | node: targetNode, |
| 34 | selection: selector(selection.editor, targetNode), |
| 35 | }, |
| 36 | ] |
| 37 | : null; |
| 38 | }; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Given a list of node finders returns a matcher which applies them in |
no outgoing calls
no test coverage detected