mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 19:17:12 +00:00
feat: Implement default-field-values
This commit is contained in:
parent
35b55fd67f
commit
7de0b2e75a
33 changed files with 647 additions and 31 deletions
|
|
@ -972,6 +972,7 @@ impl TryFrom<DefWithBody> for Definition {
|
|||
DefWithBody::Const(it) => Ok(it.into()),
|
||||
DefWithBody::Variant(it) => Ok(it.into()),
|
||||
DefWithBody::InTypeConst(_) => Err(()),
|
||||
DefWithBody::Field(it) => Ok(it.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -310,6 +310,9 @@ impl Definition {
|
|||
DefWithBody::Variant(v) => v.source(db).map(|src| src.syntax().cloned()),
|
||||
// FIXME: implement
|
||||
DefWithBody::InTypeConst(_) => return SearchScope::empty(),
|
||||
DefWithBody::Field(f) => {
|
||||
f.default_value_source(db).map(|src| src.syntax().cloned())
|
||||
}
|
||||
};
|
||||
return match def {
|
||||
Some(def) => SearchScope::file_range(
|
||||
|
|
@ -327,6 +330,9 @@ impl Definition {
|
|||
DefWithBody::Variant(v) => v.source(db).map(|src| src.syntax().cloned()),
|
||||
// FIXME: implement
|
||||
DefWithBody::InTypeConst(_) => return SearchScope::empty(),
|
||||
DefWithBody::Field(f) => {
|
||||
f.default_value_source(db).map(|src| src.syntax().cloned())
|
||||
}
|
||||
};
|
||||
return match def {
|
||||
Some(def) => SearchScope::file_range(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue