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

Function init_signature

codegraph-kernel/src/textutil.rs:247–254  ·  view source on GitHub ↗

The `= [...]` initializer signature (tree-sitter-helpers.ts initSignature): `...` when the initializer is a hundred units or longer. That is every cut, and the one that stops a unit short of the hundred so as not to split a surrogate pair is still a cut.

(value_text: &str)

Source from the content-addressed store, hash-verified

245/// hundred units or longer. That is every cut, and the one that stops a unit
246/// short of the hundred so as not to split a surrogate pair is still a cut.
247pub fn init_signature(value_text: &str) -> String {
248 let (sliced, truncated) = slice_utf16(value_text, 100);
249 if truncated || utf16_len(&sliced) >= 100 {
250 format!("= {sliced}...")
251 } else {
252 format!("= {sliced}")
253 }
254}
255
256#[cfg(test)]
257mod tests {

Callers 11

extract_variableMethod · 0.85
extract_variableMethod · 0.85
extract_variableMethod · 0.85
extract_variableMethod · 0.85
init_sig_short_and_longFunction · 0.85
visitMethod · 0.85
extract_variableMethod · 0.85
extract_variableMethod · 0.85

Calls 2

slice_utf16Function · 0.85
utf16_lenFunction · 0.85

Tested by 1

init_sig_short_and_longFunction · 0.68