mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Move symbol_index
This commit is contained in:
parent
ec95152a4e
commit
ad247aa670
7 changed files with 16 additions and 12 deletions
|
@ -15,7 +15,7 @@ use rustc_hash::FxHashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db::{DebugData, RootDatabase},
|
db::{DebugData, RootDatabase},
|
||||||
symbol_index::{SymbolIndex, SymbolsDatabase},
|
ide_db::symbol_index::{SymbolIndex, SymbolsDatabase},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
|
|
@ -12,6 +12,7 @@ use crate::{
|
||||||
db::RootDatabase,
|
db::RootDatabase,
|
||||||
display::{ShortLabel, ToNav},
|
display::{ShortLabel, ToNav},
|
||||||
expand::descend_into_macros,
|
expand::descend_into_macros,
|
||||||
|
ide_db::symbol_index,
|
||||||
references::{classify_name_ref, NameKind::*},
|
references::{classify_name_ref, NameKind::*},
|
||||||
FilePosition, NavigationTarget, RangeInfo,
|
FilePosition, NavigationTarget, RangeInfo,
|
||||||
};
|
};
|
||||||
|
@ -94,7 +95,7 @@ pub(crate) fn reference_definition(
|
||||||
};
|
};
|
||||||
|
|
||||||
// Fallback index based approach:
|
// Fallback index based approach:
|
||||||
let navs = crate::symbol_index::index_resolve(sb.db, name_ref.value)
|
let navs = symbol_index::index_resolve(sb.db, name_ref.value)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|s| s.to_nav(sb.db))
|
.map(|s| s.to_nav(sb.db))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
pub mod line_index;
|
pub mod line_index;
|
||||||
pub mod line_index_utils;
|
pub mod line_index_utils;
|
||||||
pub mod feature_flags;
|
pub mod feature_flags;
|
||||||
|
pub mod symbol_index;
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
@ -13,9 +14,8 @@ use ra_db::{
|
||||||
};
|
};
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::ide_db::{
|
||||||
ide_db::{feature_flags::FeatureFlags, line_index::LineIndex},
|
feature_flags::FeatureFlags, line_index::LineIndex, symbol_index::SymbolsDatabase,
|
||||||
symbol_index::{self, SymbolsDatabase},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[salsa::database(
|
#[salsa::database(
|
||||||
|
|
|
@ -29,7 +29,7 @@ use std::{
|
||||||
use fst::{self, Streamer};
|
use fst::{self, Streamer};
|
||||||
use ra_db::{
|
use ra_db::{
|
||||||
salsa::{self, ParallelDatabase},
|
salsa::{self, ParallelDatabase},
|
||||||
SourceDatabaseExt, SourceRootId,
|
FileId, SourceDatabaseExt, SourceRootId,
|
||||||
};
|
};
|
||||||
use ra_syntax::{
|
use ra_syntax::{
|
||||||
ast::{self, NameOwner},
|
ast::{self, NameOwner},
|
||||||
|
@ -40,7 +40,7 @@ use ra_syntax::{
|
||||||
#[cfg(not(feature = "wasm"))]
|
#[cfg(not(feature = "wasm"))]
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
|
|
||||||
use crate::{db::RootDatabase, FileId, Query};
|
use crate::{ide_db::RootDatabase, Query};
|
||||||
|
|
||||||
#[salsa::query_group(SymbolsDatabaseStorage)]
|
#[salsa::query_group(SymbolsDatabaseStorage)]
|
||||||
pub(crate) trait SymbolsDatabase: hir::db::HirDatabase {
|
pub(crate) trait SymbolsDatabase: hir::db::HirDatabase {
|
||||||
|
@ -115,7 +115,7 @@ pub(crate) fn index_resolve(db: &RootDatabase, name_ref: &ast::NameRef) -> Vec<F
|
||||||
let mut query = Query::new(name.to_string());
|
let mut query = Query::new(name.to_string());
|
||||||
query.exact();
|
query.exact();
|
||||||
query.limit(4);
|
query.limit(4);
|
||||||
crate::symbol_index::world_symbols(db, query)
|
world_symbols(db, query)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db::RootDatabase,
|
db::RootDatabase,
|
||||||
|
ide_db::symbol_index::{self, FileSymbol},
|
||||||
references::{classify_name, NameDefinition, NameKind},
|
references::{classify_name, NameDefinition, NameKind},
|
||||||
symbol_index::{self, FileSymbol},
|
|
||||||
Query,
|
Query,
|
||||||
};
|
};
|
||||||
use hir::{db::HirDatabase, ModuleDef, SourceBinder};
|
use hir::{db::HirDatabase, ModuleDef, SourceBinder};
|
||||||
|
|
|
@ -14,7 +14,6 @@ mod ide_db;
|
||||||
|
|
||||||
mod db;
|
mod db;
|
||||||
pub mod mock_analysis;
|
pub mod mock_analysis;
|
||||||
mod symbol_index;
|
|
||||||
mod change;
|
mod change;
|
||||||
mod source_change;
|
mod source_change;
|
||||||
|
|
||||||
|
@ -59,7 +58,11 @@ use ra_db::{
|
||||||
};
|
};
|
||||||
use ra_syntax::{SourceFile, TextRange, TextUnit};
|
use ra_syntax::{SourceFile, TextRange, TextUnit};
|
||||||
|
|
||||||
use crate::{db::LineIndexDatabase, display::ToNav, symbol_index::FileSymbol};
|
use crate::{
|
||||||
|
db::LineIndexDatabase,
|
||||||
|
display::ToNav,
|
||||||
|
ide_db::symbol_index::{self, FileSymbol},
|
||||||
|
};
|
||||||
|
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
assists::{Assist, AssistId},
|
assists::{Assist, AssistId},
|
||||||
|
|
|
@ -15,7 +15,7 @@ use ra_syntax::{ast, Parse, SyntaxNode};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db::RootDatabase,
|
db::RootDatabase,
|
||||||
symbol_index::{LibrarySymbolsQuery, SymbolIndex},
|
ide_db::symbol_index::{LibrarySymbolsQuery, SymbolIndex},
|
||||||
FileId,
|
FileId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue