( languageId: string, scopeType: ScopeType, includeSiblings: boolean )
| 21 | import { SupportedLanguageId } from "./constants"; |
| 22 | |
| 23 | export function getNodeMatcher( |
| 24 | languageId: string, |
| 25 | scopeType: ScopeType, |
| 26 | includeSiblings: boolean |
| 27 | ): NodeMatcher { |
| 28 | const matchers = languageMatchers[languageId as SupportedLanguageId]; |
| 29 | |
| 30 | if (matchers == null) { |
| 31 | throw new UnsupportedLanguageError(languageId); |
| 32 | } |
| 33 | |
| 34 | const matcher = matchers[scopeType]; |
| 35 | |
| 36 | if (matcher == null) { |
| 37 | return notSupported; |
| 38 | } |
| 39 | |
| 40 | if (includeSiblings) { |
| 41 | return matcherIncludeSiblings(matcher); |
| 42 | } |
| 43 | |
| 44 | return matcher; |
| 45 | } |
| 46 | |
| 47 | const languageMatchers: Record< |
| 48 | SupportedLanguageId, |
no test coverage detected