Skip to content

Commit db54f8d

Browse files
Olivier Teulierepanekj
authored andcommitted
fix: remove all the array index keys when there is more than one
The `Query::position_info_at()` function can return one index when the value is a non-empty array. In this case, the `Query::lookup_keys()` function will add another one, resulting in two index keys. But the code was only removing one, causing hover to break for keys with a non-empty array value. This change avoids the issue by removing index keys in a while loop. Closes #788
1 parent 0bcac4c commit db54f8d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crates/taplo-lsp/src/handlers/hover.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub(crate) async fn hover<E: Environment>(
112112
keys = lookup_keys(doc.dom.clone(), &keys);
113113

114114
// We're interested in the array itself, not its item type.
115-
if let Some(KeyOrIndex::Index(_)) = keys.iter().last() {
115+
while let Some(KeyOrIndex::Index(_)) = keys.iter().last() {
116116
keys = keys.skip_right(1);
117117
}
118118

0 commit comments

Comments
 (0)