(...matchers: NodeMatcher[])
| 141 | * @returns A NodeMatcher that tries the given matchers in sequence |
| 142 | */ |
| 143 | export function cascadingMatcher(...matchers: NodeMatcher[]): NodeMatcher { |
| 144 | return (selection: SelectionWithEditor, node: SyntaxNode) => { |
| 145 | for (const matcher of matchers) { |
| 146 | const match = matcher(selection, node); |
| 147 | if (match != null) { |
| 148 | return match; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | return null; |
| 153 | }; |
| 154 | } |
| 155 | |
| 156 | export const notSupported: NodeMatcher = ( |
| 157 | selection: SelectionWithEditor, |
no test coverage detected