MCPcopy Create free account
hub / github.com/douglance/devsql / extract_ts_js

Function extract_ts_js

crates/devsql/src/providers/symbols.rs:529–552  ·  view source on GitHub ↗
(content: &str)

Source from the content-addressed store, hash-verified

527});
528
529fn extract_ts_js(content: &str) -> Vec<SymbolMatch> {
530 let mut rows = Vec::new();
531 for caps in RE_TS_JS.captures_iter(content) {
532 let full_match = caps.get(0).unwrap();
533 let line_start = line_number_at(content, full_match.start());
534 let signature = line_text(content, line_start).trim().to_string();
535 let visibility = if caps.get(1).is_some() {
536 "export".to_string()
537 } else {
538 String::new()
539 };
540 let kind = caps.get(4).map(|m| m.as_str()).unwrap_or("unknown");
541 let name = caps.get(5).map(|m| m.as_str()).unwrap_or("");
542 rows.push(SymbolMatch {
543 name: name.to_string(),
544 kind: kind.to_string(),
545 line_start,
546 line_end: line_start,
547 signature,
548 visibility,
549 });
550 }
551 rows
552}
553
554static RE_PYTHON: LazyLock<Regex> =
555 LazyLock::new(|| Regex::new(r"(?m)^[[:space:]]*(class|def)\s+(\w+)").expect("Python regex"));

Callers 1

extract_symbolsFunction · 0.85

Calls 2

line_number_atFunction · 0.85
line_textFunction · 0.85

Tested by

no test coverage detected