mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
fix: Fix IDE features breaking in some attr macros
This commit is contained in:
parent
bf9a7264d1
commit
ee8a3458ee
3 changed files with 6 additions and 6 deletions
|
@ -710,8 +710,8 @@ impl ExpansionInfo {
|
||||||
self.expanded.clone()
|
self.expanded.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn call_node(&self) -> InFile<Option<SyntaxNode>> {
|
pub fn arg(&self) -> InFile<Option<&SyntaxNode>> {
|
||||||
self.arg.with_value(self.arg.value.as_ref().and_then(SyntaxNode::parent))
|
self.arg.as_ref().map(|it| it.as_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn call_file(&self) -> HirFileId {
|
pub fn call_file(&self) -> HirFileId {
|
||||||
|
|
|
@ -772,7 +772,7 @@ impl<'db> SemanticsImpl<'db> {
|
||||||
let exp_info = macro_file.expansion_info(self.db.upcast());
|
let exp_info = macro_file.expansion_info(self.db.upcast());
|
||||||
|
|
||||||
let InMacroFile { file_id, value } = exp_info.expanded();
|
let InMacroFile { file_id, value } = exp_info.expanded();
|
||||||
if let InFile { file_id, value: Some(value) } = exp_info.call_node() {
|
if let InFile { file_id, value: Some(value) } = exp_info.arg() {
|
||||||
self.cache(value.ancestors().last().unwrap(), file_id);
|
self.cache(value.ancestors().last().unwrap(), file_id);
|
||||||
}
|
}
|
||||||
self.cache(value, file_id.into());
|
self.cache(value, file_id.into());
|
||||||
|
@ -786,7 +786,7 @@ impl<'db> SemanticsImpl<'db> {
|
||||||
// FIXME: uncached parse
|
// FIXME: uncached parse
|
||||||
// Create the source analyzer for the macro call scope
|
// Create the source analyzer for the macro call scope
|
||||||
let Some(sa) = expansion_info
|
let Some(sa) = expansion_info
|
||||||
.call_node()
|
.arg()
|
||||||
.value
|
.value
|
||||||
.and_then(|it| self.analyze_no_infer(&it.ancestors().last().unwrap()))
|
.and_then(|it| self.analyze_no_infer(&it.ancestors().last().unwrap()))
|
||||||
else {
|
else {
|
||||||
|
@ -1145,7 +1145,7 @@ impl<'db> SemanticsImpl<'db> {
|
||||||
.expansion_info_cache
|
.expansion_info_cache
|
||||||
.entry(macro_file)
|
.entry(macro_file)
|
||||||
.or_insert_with(|| macro_file.expansion_info(self.db.upcast()));
|
.or_insert_with(|| macro_file.expansion_info(self.db.upcast()));
|
||||||
expansion_info.call_node().transpose()
|
expansion_info.arg().map(|node| node?.parent()).transpose()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,7 +434,7 @@ impl SourceToDefCtx<'_, '_> {
|
||||||
.entry(macro_file)
|
.entry(macro_file)
|
||||||
.or_insert_with(|| macro_file.expansion_info(this.db.upcast()));
|
.or_insert_with(|| macro_file.expansion_info(this.db.upcast()));
|
||||||
|
|
||||||
expansion_info.call_node().map(|node| node?.parent()).transpose()
|
expansion_info.arg().map(|node| node?.parent()).transpose()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut node = node.cloned();
|
let mut node = node.cloned();
|
||||||
|
|
Loading…
Reference in a new issue