Skip to content

Commit 37c13ce

Browse files
committed
Extend range of assignment symbols to end of node
1 parent f67b10f commit 37c13ce

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

crates/ark/src/lsp/snapshots/ark__lsp__symbols__tests__symbol_rhs_braced_list.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ expression: "test_symbol(\"\nfoo <- {\n bar <- function() {}\n}\n\")"
1515
character: 0,
1616
},
1717
end: Position {
18-
line: 1,
19-
character: 3,
18+
line: 3,
19+
character: 1,
2020
},
2121
},
2222
selection_range: Range {
@@ -25,8 +25,8 @@ expression: "test_symbol(\"\nfoo <- {\n bar <- function() {}\n}\n\")"
2525
character: 0,
2626
},
2727
end: Position {
28-
line: 1,
29-
character: 3,
28+
line: 3,
29+
character: 1,
3030
},
3131
},
3232
children: Some(

crates/ark/src/lsp/snapshots/ark__lsp__symbols__tests__symbol_rhs_methods.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ expression: "test_symbol(\"\n# section ----\nclass <- r6::r6class(\n 'class',\n
4343
character: 0,
4444
},
4545
end: Position {
46-
line: 2,
47-
character: 5,
46+
line: 11,
47+
character: 1,
4848
},
4949
},
5050
selection_range: Range {
@@ -53,8 +53,8 @@ expression: "test_symbol(\"\n# section ----\nclass <- r6::r6class(\n 'class',\n
5353
character: 0,
5454
},
5555
end: Position {
56-
line: 2,
57-
character: 5,
56+
line: 11,
57+
character: 1,
5858
},
5959
},
6060
children: Some(

crates/ark/src/lsp/symbols.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,8 @@ fn collect_assignment(
424424
// Otherwise, collect as generic object
425425
let name = contents.node_slice(&lhs)?.to_string();
426426

427-
let start = convert_point_to_position(contents, lhs.start_position());
428-
let end = convert_point_to_position(contents, lhs.end_position());
427+
let start = convert_point_to_position(contents, node.start_position());
428+
let end = convert_point_to_position(contents, node.end_position());
429429

430430
// Now recurse into RHS
431431
let mut children = Vec::new();
@@ -583,7 +583,7 @@ mod tests {
583583
},
584584
end: Position {
585585
line: 0,
586-
character: 3,
586+
character: 8,
587587
},
588588
};
589589
assert_eq!(test_symbol("foo <- 1"), vec![new_symbol(
@@ -621,7 +621,7 @@ mod tests {
621621
},
622622
end: Position {
623623
line: 0,
624-
character: 23,
624+
character: 28,
625625
},
626626
};
627627
let bar = new_symbol(String::from("bar"), SymbolKind::VARIABLE, range);
@@ -667,7 +667,7 @@ foo <- function() {
667667
},
668668
end: Position {
669669
line: 0,
670-
character: 5,
670+
character: 10,
671671
},
672672
};
673673
let foo = new_symbol(String::from("foo"), SymbolKind::VARIABLE, range);

0 commit comments

Comments
 (0)