mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
provide completion in struct patterns
This commit is contained in:
parent
7bde8012cb
commit
5fe19d2fbd
7 changed files with 134 additions and 21 deletions
|
@ -266,9 +266,14 @@ impl SourceAnalyzer {
|
|||
self.infer.as_ref()?.field_resolution(expr_id)
|
||||
}
|
||||
|
||||
pub fn resolve_variant(&self, struct_lit: &ast::StructLit) -> Option<crate::VariantDef> {
|
||||
pub fn resolve_struct_literal(&self, struct_lit: &ast::StructLit) -> Option<crate::VariantDef> {
|
||||
let expr_id = self.body_source_map.as_ref()?.node_expr(&struct_lit.clone().into())?;
|
||||
self.infer.as_ref()?.variant_resolution(expr_id)
|
||||
self.infer.as_ref()?.variant_resolution_for_expr(expr_id)
|
||||
}
|
||||
|
||||
pub fn resolve_struct_pattern(&self, struct_pat: &ast::StructPat) -> Option<crate::VariantDef> {
|
||||
let pat_id = self.body_source_map.as_ref()?.node_pat(&struct_pat.clone().into())?;
|
||||
self.infer.as_ref()?.variant_resolution_for_pat(pat_id)
|
||||
}
|
||||
|
||||
pub fn resolve_macro_call(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue