feat: implement hover on when clause patterns

This commit is contained in:
rvcas 2023-11-28 16:13:08 -05:00
parent f7dd2de17b
commit a46a7e82b7
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
2 changed files with 5 additions and 3 deletions

View File

@ -1169,8 +1169,10 @@ impl TypedClause {
}
}
pub fn find_node(&self, byte_index: usize) -> Option<Located<'_>> {
self.then.find_node(byte_index)
pub fn find_node(&self, byte_index: usize, subject_type: &Rc<Type>) -> Option<Located<'_>> {
self.pattern
.find_node(byte_index, subject_type)
.or_else(|| self.then.find_node(byte_index))
}
}

View File

@ -378,7 +378,7 @@ impl TypedExpr {
.or_else(|| {
clauses
.iter()
.find_map(|clause| clause.find_node(byte_index))
.find_map(|clause| clause.find_node(byte_index, &subject.tipo()))
})
.or(Some(Located::Expression(self))),