MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / extract_class_name_backward

Function extract_class_name_backward

src/completion/named_args.rs:353–364  ·  view source on GitHub ↗

Extract a class name (possibly namespace-qualified) before `::`. `colon_pos` points to the first `:` of `::`.

(chars: &[char], colon_pos: usize)

Source from the content-addressed store, hash-verified

351///
352/// `colon_pos` points to the first `:` of `::`.
353pub fn extract_class_name_backward(chars: &[char], colon_pos: usize) -> String {
354 let mut i = colon_pos;
355 // Skip whitespace
356 while i > 0 && chars[i - 1] == ' ' {
357 i -= 1;
358 }
359 let end = i;
360 while i > 0 && (chars[i - 1].is_alphanumeric() || chars[i - 1] == '_' || chars[i - 1] == '\\') {
361 i -= 1;
362 }
363 chars[i..end].iter().collect()
364}
365
366/// Parse the arguments text between `(` and the cursor to determine:
367/// - Which parameter names have already been used as named arguments

Callers 1

extract_call_expressionFunction · 0.85

Calls 1

iterMethod · 0.80

Tested by

no test coverage detected