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

Function parse_unmatched_line

src/code_actions/phpstan/ignore.rs:550–557  ·  view source on GitHub ↗

Parse the line number from an unmatched-ignore error message. PHPStan format: `"No error with identifier is reported on line ."` Returns a 0-based LSP line number.

(message: &str)

Source from the content-addressed store, hash-verified

548/// PHPStan format: `"No error with identifier <id> is reported on line <N>."`
549/// Returns a 0-based LSP line number.
550fn parse_unmatched_line(message: &str) -> Option<u32> {
551 let prefix = "is reported on line ";
552 let start = message.find(prefix)?;
553 let after = &message[start + prefix.len()..];
554 let end = after.find('.')?;
555 let line_1based: u32 = after[..end].parse().ok()?;
556 Some(line_1based.saturating_sub(1))
557}
558
559/// Check whether a PHPStan diagnostic is ignorable.
560///

Callers 1

resolve_remove_ignoreMethod · 0.85

Calls 2

findMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected