mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
fix: Don't emit empty scip occurrence for builtins
This commit is contained in:
parent
ca47cddc31
commit
4d650702af
@ -139,19 +139,17 @@ impl flags::Scip {
|
|||||||
let mut occurrences = Vec::new();
|
let mut occurrences = Vec::new();
|
||||||
let mut symbols = Vec::new();
|
let mut symbols = Vec::new();
|
||||||
|
|
||||||
tokens.into_iter().for_each(|(text_range, id)| {
|
for (text_range, id) in tokens.into_iter() {
|
||||||
let token = si.tokens.get(id).unwrap();
|
let token = si.tokens.get(id).unwrap();
|
||||||
|
|
||||||
let (symbol, enclosing_symbol, is_inherent_impl) =
|
let Some(TokenSymbols { symbol, enclosing_symbol, is_inherent_impl }) =
|
||||||
if let Some(TokenSymbols { symbol, enclosing_symbol, is_inherent_impl }) =
|
|
||||||
symbol_generator.token_symbols(id, token)
|
symbol_generator.token_symbols(id, token)
|
||||||
{
|
else {
|
||||||
(symbol, enclosing_symbol, is_inherent_impl)
|
// token did not have a moniker, so there is no reasonable occurrence to emit
|
||||||
} else {
|
// see ide::moniker::def_to_moniker
|
||||||
("".to_owned(), None, false)
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
if !symbol.is_empty() {
|
|
||||||
let is_defined_in_this_document = match token.definition {
|
let is_defined_in_this_document = match token.definition {
|
||||||
Some(def) => def.file_id == file_id,
|
Some(def) => def.file_id == file_id,
|
||||||
_ => false,
|
_ => false,
|
||||||
@ -178,7 +176,6 @@ impl flags::Scip {
|
|||||||
} else {
|
} else {
|
||||||
token_ids_referenced.insert(id);
|
token_ids_referenced.insert(id);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// If the range of the def and the range of the token are the same, this must be the definition.
|
// If the range of the def and the range of the token are the same, this must be the definition.
|
||||||
// they also must be in the same file. See https://github.com/rust-lang/rust-analyzer/pull/17988
|
// they also must be in the same file. See https://github.com/rust-lang/rust-analyzer/pull/17988
|
||||||
@ -202,7 +199,7 @@ impl flags::Scip {
|
|||||||
special_fields: Default::default(),
|
special_fields: Default::default(),
|
||||||
enclosing_range: Vec::new(),
|
enclosing_range: Vec::new(),
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
if occurrences.is_empty() {
|
if occurrences.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user