feat(lsp): hover support for the optional multi validator fn
This commit is contained in:
parent
2159053cb5
commit
7015a9badc
|
@ -426,16 +426,31 @@ impl TypedDefinition {
|
||||||
pub fn find_node(&self, byte_index: usize) -> Option<Located<'_>> {
|
pub fn find_node(&self, byte_index: usize) -> Option<Located<'_>> {
|
||||||
// Note that the fn span covers the function head, not
|
// Note that the fn span covers the function head, not
|
||||||
// the entire statement.
|
// the entire statement.
|
||||||
if let Definition::Fn(Function { body, .. })
|
match self {
|
||||||
| Definition::Validator(Validator {
|
Definition::Fn(Function { body, .. }) | Definition::Test(Function { body, .. }) => {
|
||||||
fun: Function { body, .. },
|
if let Some(located) = body.find_node(byte_index) {
|
||||||
..
|
return Some(located);
|
||||||
})
|
}
|
||||||
| Definition::Test(Function { body, .. }) = self
|
|
||||||
{
|
|
||||||
if let Some(located) = body.find_node(byte_index) {
|
|
||||||
return Some(located);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Definition::Validator(Validator {
|
||||||
|
fun: Function { body, .. },
|
||||||
|
other_fun:
|
||||||
|
Some(Function {
|
||||||
|
body: other_body, ..
|
||||||
|
}),
|
||||||
|
..
|
||||||
|
}) => {
|
||||||
|
if let Some(located) = body.find_node(byte_index) {
|
||||||
|
return Some(located);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(located) = other_body.find_node(byte_index) {
|
||||||
|
return Some(located);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.location().contains(byte_index) {
|
if self.location().contains(byte_index) {
|
||||||
|
|
Loading…
Reference in New Issue