Move symbol_index

This commit is contained in:
Aleksey Kladov 2020-02-06 12:22:35 +01:00
parent ec95152a4e
commit ad247aa670
7 changed files with 16 additions and 12 deletions

View File

@ -15,7 +15,7 @@
use crate::{
db::{DebugData, RootDatabase},
symbol_index::{SymbolIndex, SymbolsDatabase},
ide_db::symbol_index::{SymbolIndex, SymbolsDatabase},
};
#[derive(Default)]

View File

@ -12,6 +12,7 @@
db::RootDatabase,
display::{ShortLabel, ToNav},
expand::descend_into_macros,
ide_db::symbol_index,
references::{classify_name_ref, NameKind::*},
FilePosition, NavigationTarget, RangeInfo,
};
@ -94,7 +95,7 @@ pub(crate) fn reference_definition(
};
// 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()
.map(|s| s.to_nav(sb.db))
.collect();

View File

@ -3,6 +3,7 @@
pub mod line_index;
pub mod line_index_utils;
pub mod feature_flags;
pub mod symbol_index;
use std::sync::Arc;
@ -13,9 +14,8 @@
};
use rustc_hash::FxHashMap;
use crate::{
ide_db::{feature_flags::FeatureFlags, line_index::LineIndex},
symbol_index::{self, SymbolsDatabase},
use crate::ide_db::{
feature_flags::FeatureFlags, line_index::LineIndex, symbol_index::SymbolsDatabase,
};
#[salsa::database(

View File

@ -29,7 +29,7 @@
use fst::{self, Streamer};
use ra_db::{
salsa::{self, ParallelDatabase},
SourceDatabaseExt, SourceRootId,
FileId, SourceDatabaseExt, SourceRootId,
};
use ra_syntax::{
ast::{self, NameOwner},
@ -40,7 +40,7 @@
#[cfg(not(feature = "wasm"))]
use rayon::prelude::*;
use crate::{db::RootDatabase, FileId, Query};
use crate::{ide_db::RootDatabase, Query};
#[salsa::query_group(SymbolsDatabaseStorage)]
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());
query.exact();
query.limit(4);
crate::symbol_index::world_symbols(db, query)
world_symbols(db, query)
}
#[derive(Default)]

View File

@ -3,8 +3,8 @@
use crate::{
db::RootDatabase,
ide_db::symbol_index::{self, FileSymbol},
references::{classify_name, NameDefinition, NameKind},
symbol_index::{self, FileSymbol},
Query,
};
use hir::{db::HirDatabase, ModuleDef, SourceBinder};

View File

@ -14,7 +14,6 @@
mod db;
pub mod mock_analysis;
mod symbol_index;
mod change;
mod source_change;
@ -59,7 +58,11 @@
};
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::{
assists::{Assist, AssistId},

View File

@ -15,7 +15,7 @@
use crate::{
db::RootDatabase,
symbol_index::{LibrarySymbolsQuery, SymbolIndex},
ide_db::symbol_index::{LibrarySymbolsQuery, SymbolIndex},
FileId,
};