mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-14 22:35:11 +00:00
Merge #10704
10704: internal: Short-circuit `descend_into_macros_single` r=Veykril a=Veykril There is no need to descend everything if all we are interested in is the first mapping. This bring `descend_into_macros` timing in highlighting in `rust-analyzer/src/config.rs` from `154ms - descend_into_macros (2190 calls)` to `24ms - descend_into_macros (2190 calls)` since we use the single variant there(will regress once we want to highlight multiple namespaces again though). bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
726b4dd8bd
2 changed files with 84 additions and 52 deletions
|
@ -18,7 +18,7 @@ pub mod eager;
|
|||
use base_db::ProcMacroKind;
|
||||
use either::Either;
|
||||
|
||||
pub use mbe::{ExpandError, ExpandResult};
|
||||
pub use mbe::{ExpandError, ExpandResult, Origin};
|
||||
|
||||
use std::{hash::Hash, iter, sync::Arc};
|
||||
|
||||
|
@ -380,9 +380,11 @@ pub struct ExpansionInfo {
|
|||
exp_map: Arc<mbe::TokenMap>,
|
||||
}
|
||||
|
||||
pub use mbe::Origin;
|
||||
|
||||
impl ExpansionInfo {
|
||||
pub fn expanded(&self) -> InFile<SyntaxNode> {
|
||||
self.expanded.clone()
|
||||
}
|
||||
|
||||
pub fn call_node(&self) -> Option<InFile<SyntaxNode>> {
|
||||
Some(self.arg.with_value(self.arg.value.parent()?))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue