feat(lsp): find_node for TypedArgVia

This commit is contained in:
rvcas
2024-04-02 19:22:19 -04:00
parent d22ee6e086
commit 7c5b9aa35e
2 changed files with 132 additions and 40 deletions

View File

@@ -399,6 +399,12 @@ impl Server {
// TODO: autocompletion for expressions
Some(Located::Expression(_expression)) => None,
// TODO: autocompletion for arguments?
Some(Located::Argument(_arg_name, _tipo)) => None,
// TODO: autocompletion for annotation?
Some(Located::Annotation(_annotation)) => None,
}
}
@@ -510,7 +516,9 @@ impl Server {
Some(expression.tipo()),
),
Located::Pattern(pattern, tipo) => (pattern.location(), None, Some(tipo)),
Located::Argument(arg_name, tipo) => (arg_name.location(), None, Some(tipo)),
Located::Definition(_) => return Ok(None),
Located::Annotation(_) => return Ok(None),
};
let doc = definition_location
@@ -525,6 +533,8 @@ impl Server {
.and_then(|node| match node {
Located::Expression(_) => None,
Located::Pattern(_, _) => None,
Located::Argument(_, _) => None,
Located::Annotation(_) => None,
Located::Definition(def) => def.doc(),
})
.unwrap_or_default();