mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 10:39:45 +00:00
Merge pull request #19981 from Veykril/push-tzzunsrqqunv
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
fix: Do not force descend into derives for goto IDE features
This commit is contained in:
commit
7011fd054f
4 changed files with 6 additions and 5 deletions
|
|
@ -244,7 +244,7 @@ impl<DB: HirDatabase + ?Sized> Semantics<'_, DB> {
|
|||
offset: TextSize,
|
||||
) -> impl Iterator<Item = ast::NameLike> + 'slf {
|
||||
node.token_at_offset(offset)
|
||||
.map(move |token| self.descend_into_macros_no_opaque(token))
|
||||
.map(move |token| self.descend_into_macros_no_opaque(token, true))
|
||||
.map(|descendants| descendants.into_iter().filter_map(move |it| it.value.parent()))
|
||||
// re-order the tokens from token_at_offset by returning the ancestors with the smaller first nodes first
|
||||
// See algo::ancestors_at_offset, which uses the same approach
|
||||
|
|
@ -1009,10 +1009,11 @@ impl<'db> SemanticsImpl<'db> {
|
|||
pub fn descend_into_macros_no_opaque(
|
||||
&self,
|
||||
token: SyntaxToken,
|
||||
always_descend_into_derives: bool,
|
||||
) -> SmallVec<[InFile<SyntaxToken>; 1]> {
|
||||
let mut res = smallvec![];
|
||||
let token = self.wrap_token_infile(token);
|
||||
self.descend_into_macros_all(token.clone(), true, &mut |t, ctx| {
|
||||
self.descend_into_macros_all(token.clone(), always_descend_into_derives, &mut |t, ctx| {
|
||||
if !ctx.is_opaque(self.db) {
|
||||
// Don't descend into opaque contexts
|
||||
res.push(t);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ pub(crate) fn goto_declaration(
|
|||
.find(|it| matches!(it.kind(), IDENT | T![self] | T![super] | T![crate] | T![Self]))?;
|
||||
let range = original_token.text_range();
|
||||
let info: Vec<NavigationTarget> = sema
|
||||
.descend_into_macros_no_opaque(original_token)
|
||||
.descend_into_macros_no_opaque(original_token, false)
|
||||
.iter()
|
||||
.filter_map(|token| {
|
||||
let parent = token.value.parent()?;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ pub(crate) fn goto_definition(
|
|||
}
|
||||
|
||||
let navs = sema
|
||||
.descend_into_macros_no_opaque(original_token.clone())
|
||||
.descend_into_macros_no_opaque(original_token.clone(), false)
|
||||
.into_iter()
|
||||
.filter_map(|token| {
|
||||
let parent = token.value.parent()?;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ pub(crate) fn goto_type_definition(
|
|||
}
|
||||
|
||||
let range = token.text_range();
|
||||
sema.descend_into_macros_no_opaque(token)
|
||||
sema.descend_into_macros_no_opaque(token,false)
|
||||
.into_iter()
|
||||
.filter_map(|token| {
|
||||
sema
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue