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

Function flatten

src/selection_range.rs:909–917  ·  view source on GitHub ↗

Flatten a SelectionRange linked list into a Vec of Ranges (innermost first).

(sel: &SelectionRange)

Source from the content-addressed store, hash-verified

907
908 /// Flatten a SelectionRange linked list into a Vec of Ranges (innermost first).
909 fn flatten(sel: &SelectionRange) -> Vec<Range> {
910 let mut result = vec![sel.range];
911 let mut current = &sel.parent;
912 while let Some(parent) = current {
913 result.push(parent.range);
914 current = &parent.parent;
915 }
916 result
917 }
918
919 #[test]
920 fn single_variable_in_function() {

Callers 15

class_method_bodyFunction · 0.85
multiple_positionsFunction · 0.85
nested_if_statementFunction · 0.85
empty_fileFunction · 0.85
ranges_are_nestedFunction · 0.85
foreach_value_variableFunction · 0.85
foreach_key_valueFunction · 0.85
for_loop_bodyFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by 15

class_method_bodyFunction · 0.68
multiple_positionsFunction · 0.68
nested_if_statementFunction · 0.68
empty_fileFunction · 0.68
ranges_are_nestedFunction · 0.68
foreach_value_variableFunction · 0.68
foreach_key_valueFunction · 0.68
for_loop_bodyFunction · 0.68