mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
scip: Populate SymbolInformation::enclosing_symbol
For local variables, this gets the moniker from the enclosing definition and stores it into the TokenStaticData. Then it builds the scip symbol for that moniker when building the SymbolInformation.
This commit is contained in:
parent
62663e6d4b
commit
495a55689b
3 changed files with 40 additions and 5 deletions
|
@ -47,6 +47,7 @@ pub struct TokenStaticData {
|
|||
pub references: Vec<ReferenceData>,
|
||||
pub moniker: Option<MonikerResult>,
|
||||
pub display_name: Option<String>,
|
||||
pub enclosing_moniker: Option<MonikerResult>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
|
@ -174,6 +175,9 @@ impl StaticIndex<'_> {
|
|||
references: vec![],
|
||||
moniker: current_crate.and_then(|cc| def_to_moniker(self.db, def, cc)),
|
||||
display_name: def.name(self.db).map(|name| name.display(self.db).to_string()),
|
||||
enclosing_moniker: current_crate
|
||||
.zip(def.enclosing_definition(self.db))
|
||||
.and_then(|(cc, enclosing_def)| def_to_moniker(self.db, enclosing_def, cc)),
|
||||
});
|
||||
self.def_map.insert(def, it);
|
||||
it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue