MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / longer_than_units

Method longer_than_units

codegraph-kernel/src/tsjs/extractors.rs:1166–1172  ·  view source on GitHub ↗

Whether `node`'s text is longer than `units` UTF-16 units, which is how tree-sitter.ts measures it. The bytes settle it without a count unless they are between one and three times as many.

(&self, node: Node<'t>, units: usize)

Source from the content-addressed store, hash-verified

1164 /// tree-sitter.ts measures it. The bytes settle it without a count unless
1165 /// they are between one and three times as many.
1166 fn longer_than_units(&self, node: Node<'t>, units: usize) -> bool {
1167 let bytes = node.end_byte() - node.start_byte();
1168 if bytes <= units {
1169 return false;
1170 }
1171 bytes > units * 3 || util::utf16_len(self.text(node)) > units
1172 }
1173
1174 /// `holders` are the members between the owner and `obj` that have no node
1175 /// yet, outermost first: each holds the literal the next is written in. The

Callers 1

Calls 2

utf16_lenFunction · 0.85
textMethod · 0.65

Tested by

no test coverage detected