Simple names of every annotation in a node's `modifiers` child (`@lombok.Getter` → `Getter`).
(node: SyntaxNode)
| 57 | |
| 58 | /** Simple names of every annotation in a node's `modifiers` child (`@lombok.Getter` → `Getter`). */ |
| 59 | function lombokAnnotationNames(node: SyntaxNode): Set<string> { |
| 60 | const names = new Set<string>(); |
| 61 | const modifiers = node.namedChildren.find((c: SyntaxNode) => c.type === 'modifiers'); |
| 62 | if (!modifiers) return names; |
| 63 | for (const child of modifiers.namedChildren) { |
| 64 | if (child.type === 'marker_annotation' || child.type === 'annotation') { |
| 65 | const nameNode = getChildByField(child, 'name'); |
| 66 | const simple = nameNode ? nameNode.text.trim().split('.').pop() : undefined; |
| 67 | if (simple) names.add(simple); |
| 68 | } |
| 69 | } |
| 70 | return names; |
| 71 | } |
| 72 | |
| 73 | /** Text of a declaration's `modifiers` child (keyword modifiers are anonymous, so match on text). */ |
| 74 | function modifierTextOf(node: SyntaxNode): string { |
no test coverage detected