mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
embed file_id into FileSymbol
This commit is contained in:
parent
23d45177e2
commit
9bb2a74256
3 changed files with 34 additions and 35 deletions
|
@ -237,11 +237,11 @@ pub struct NavigationTarget {
|
|||
}
|
||||
|
||||
impl NavigationTarget {
|
||||
fn from_symbol(file_id: FileId, symbol: FileSymbol) -> NavigationTarget {
|
||||
fn from_symbol(symbol: FileSymbol) -> NavigationTarget {
|
||||
NavigationTarget {
|
||||
file_id: symbol.file_id,
|
||||
name: symbol.name.clone(),
|
||||
kind: symbol.ptr.kind(),
|
||||
file_id,
|
||||
range: symbol.ptr.range(),
|
||||
ptr: Some(symbol.ptr.clone()),
|
||||
}
|
||||
|
@ -278,11 +278,6 @@ impl ReferenceResolution {
|
|||
resolves_to: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
fn add_resolution(&mut self, file_id: FileId, symbol: FileSymbol) {
|
||||
self.resolves_to
|
||||
.push(NavigationTarget::from_symbol(file_id, symbol))
|
||||
}
|
||||
}
|
||||
|
||||
/// `AnalysisHost` stores the current state of the world.
|
||||
|
@ -380,7 +375,7 @@ impl Analysis {
|
|||
pub fn symbol_search(&self, query: Query) -> Cancelable<Vec<NavigationTarget>> {
|
||||
let res = symbol_index::world_symbols(&*self.db, query)?
|
||||
.into_iter()
|
||||
.map(|(file_id, symbol)| NavigationTarget::from_symbol(file_id, symbol))
|
||||
.map(NavigationTarget::from_symbol)
|
||||
.collect();
|
||||
Ok(res)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue