Improve autocompletion by looking on the type and name

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
Benjamin Coenen 2020-04-11 22:54:18 +02:00
parent c1317d6923
commit d42346fed6
6 changed files with 194 additions and 30 deletions

View file

@ -127,6 +127,21 @@ pub struct CallInfo {
pub active_parameter: Option<usize>,
}
impl CallInfo {
pub fn active_parameter_type(&self) -> Option<String> {
if let Some(id) = self.active_parameter {
return self.signature.parameter_types.get(id).map(|param_ty| param_ty.clone());
}
None
}
pub fn active_parameter_name(&self) -> Option<String> {
if let Some(id) = self.active_parameter {
return self.signature.parameter_names.get(id).map(|param_ty| param_ty.clone());
}
None
}
}
/// `AnalysisHost` stores the current state of the world.
#[derive(Debug)]
pub struct AnalysisHost {