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

Function detect_member_indent

src/code_actions/extract_constant.rs:579–591  ·  view source on GitHub ↗

Determine the indentation used for members inside the class body. Looks at the line after the opening brace to detect the indent.

(content: &str, body_start: usize)

Source from the content-addressed store, hash-verified

577/// Determine the indentation used for members inside the class body.
578/// Looks at the line after the opening brace to detect the indent.
579fn detect_member_indent(content: &str, body_start: usize) -> String {
580 // Find the first newline after the opening brace.
581 if let Some(nl_pos) = content[body_start..].find('\n') {
582 let line_start = body_start + nl_pos + 1;
583 let rest = &content[line_start..];
584 let indent_len = rest.chars().take_while(|c| *c == ' ' || *c == '\t').count();
585 if indent_len > 0 {
586 return rest[..indent_len].to_string();
587 }
588 }
589 // Fallback: 4 spaces.
590 " ".to_string()
591}
592
593// ─── Code action ────────────────────────────────────────────────────────────
594

Callers 1

Calls 2

findMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected