Auto merge of #18234 - Veykril:veykril/push-vzynqtlxmrnl, r=Veykril

internal: Filter out opaque tokens in some IDE feature macro descensions
This commit is contained in:
bors 2024-10-04 10:26:04 +00:00
commit 510f72e12c
11 changed files with 114 additions and 70 deletions

View file

@ -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(original_token)
.descend_into_macros_no_opaque(original_token)
.iter()
.filter_map(|token| {
let parent = token.parent()?;

View file

@ -83,7 +83,7 @@ pub(crate) fn goto_definition(
}
let navs = sema
.descend_into_macros(original_token.clone())
.descend_into_macros_no_opaque(original_token.clone())
.into_iter()
.filter_map(|token| {
let parent = token.parent()?;

View file

@ -69,7 +69,7 @@ pub(crate) fn goto_type_definition(
}
let range = token.text_range();
sema.descend_into_macros(token)
sema.descend_into_macros_no_opaque(token)
.into_iter()
.filter_map(|token| {
let ty = sema

View file

@ -409,7 +409,8 @@ fn traverse(
let mut r = 0;
sema.descend_into_macros_breakable(
InRealFile::new(file_id, token.clone()),
|tok| {
|tok, _ctx| {
// FIXME: Consider checking ctx transparency for being opaque?
let tok = tok.value;
let tok_kind = tok.kind();