prettier-plugin-awk
Version:
[](https://github.com/Beaglefoot/prettier-plugin-awk/actions/workflows/tests.yml) [](https://www.npmjs
11 lines (8 loc) • 352 B
text/typescript
import { SyntaxNode } from 'tree-sitter'
export function doesCommentBelongToNode(node: SyntaxNode): boolean {
if (!node.previousNamedSibling || node.type !== 'comment') return false
return (
node.previousNamedSibling.startPosition.row <= node.startPosition.row &&
node.previousNamedSibling.endPosition.row >= node.startPosition.row
)
}