diff options
author | Aleksey Kladov <[email protected]> | 2020-02-06 11:22:35 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-02-06 11:22:35 +0000 |
commit | ad247aa67061f4dcba85e20b82ca47e9a86eff56 (patch) | |
tree | 220d5b4405804aa276d4651e095885973f82320a | |
parent | ec95152a4ec1ed617452c8578df128a117ab0b5d (diff) |
Move symbol_index
-rw-r--r-- | crates/ra_ide/src/change.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_definition.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide/src/ide_db/mod.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide/src/ide_db/symbol_index.rs (renamed from crates/ra_ide/src/symbol_index.rs) | 6 | ||||
-rw-r--r-- | crates/ra_ide/src/imports_locator.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/lib.rs | 7 | ||||
-rw-r--r-- | crates/ra_ide/src/status.rs | 2 |
7 files changed, 16 insertions, 12 deletions
diff --git a/crates/ra_ide/src/change.rs b/crates/ra_ide/src/change.rs index 18dad2ea3..a0aeee1f7 100644 --- a/crates/ra_ide/src/change.rs +++ b/crates/ra_ide/src/change.rs | |||
@@ -15,7 +15,7 @@ use rustc_hash::FxHashMap; | |||
15 | 15 | ||
16 | use crate::{ | 16 | use crate::{ |
17 | db::{DebugData, RootDatabase}, | 17 | db::{DebugData, RootDatabase}, |
18 | symbol_index::{SymbolIndex, SymbolsDatabase}, | 18 | ide_db::symbol_index::{SymbolIndex, SymbolsDatabase}, |
19 | }; | 19 | }; |
20 | 20 | ||
21 | #[derive(Default)] | 21 | #[derive(Default)] |
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 5a12a619c..b67e32626 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -12,6 +12,7 @@ use crate::{ | |||
12 | db::RootDatabase, | 12 | db::RootDatabase, |
13 | display::{ShortLabel, ToNav}, | 13 | display::{ShortLabel, ToNav}, |
14 | expand::descend_into_macros, | 14 | expand::descend_into_macros, |
15 | ide_db::symbol_index, | ||
15 | references::{classify_name_ref, NameKind::*}, | 16 | references::{classify_name_ref, NameKind::*}, |
16 | FilePosition, NavigationTarget, RangeInfo, | 17 | FilePosition, NavigationTarget, RangeInfo, |
17 | }; | 18 | }; |
@@ -94,7 +95,7 @@ pub(crate) fn reference_definition( | |||
94 | }; | 95 | }; |
95 | 96 | ||
96 | // Fallback index based approach: | 97 | // Fallback index based approach: |
97 | let navs = crate::symbol_index::index_resolve(sb.db, name_ref.value) | 98 | let navs = symbol_index::index_resolve(sb.db, name_ref.value) |
98 | .into_iter() | 99 | .into_iter() |
99 | .map(|s| s.to_nav(sb.db)) | 100 | .map(|s| s.to_nav(sb.db)) |
100 | .collect(); | 101 | .collect(); |
diff --git a/crates/ra_ide/src/ide_db/mod.rs b/crates/ra_ide/src/ide_db/mod.rs index 834ad0135..924ee9968 100644 --- a/crates/ra_ide/src/ide_db/mod.rs +++ b/crates/ra_ide/src/ide_db/mod.rs | |||
@@ -3,6 +3,7 @@ | |||
3 | pub mod line_index; | 3 | pub mod line_index; |
4 | pub mod line_index_utils; | 4 | pub mod line_index_utils; |
5 | pub mod feature_flags; | 5 | pub mod feature_flags; |
6 | pub mod symbol_index; | ||
6 | 7 | ||
7 | use std::sync::Arc; | 8 | use std::sync::Arc; |
8 | 9 | ||
@@ -13,9 +14,8 @@ use ra_db::{ | |||
13 | }; | 14 | }; |
14 | use rustc_hash::FxHashMap; | 15 | use rustc_hash::FxHashMap; |
15 | 16 | ||
16 | use crate::{ | 17 | use crate::ide_db::{ |
17 | ide_db::{feature_flags::FeatureFlags, line_index::LineIndex}, | 18 | feature_flags::FeatureFlags, line_index::LineIndex, symbol_index::SymbolsDatabase, |
18 | symbol_index::{self, SymbolsDatabase}, | ||
19 | }; | 19 | }; |
20 | 20 | ||
21 | #[salsa::database( | 21 | #[salsa::database( |
diff --git a/crates/ra_ide/src/symbol_index.rs b/crates/ra_ide/src/ide_db/symbol_index.rs index 5729eb5b3..4ceb5e66f 100644 --- a/crates/ra_ide/src/symbol_index.rs +++ b/crates/ra_ide/src/ide_db/symbol_index.rs | |||
@@ -29,7 +29,7 @@ use std::{ | |||
29 | use fst::{self, Streamer}; | 29 | use fst::{self, Streamer}; |
30 | use ra_db::{ | 30 | use ra_db::{ |
31 | salsa::{self, ParallelDatabase}, | 31 | salsa::{self, ParallelDatabase}, |
32 | SourceDatabaseExt, SourceRootId, | 32 | FileId, SourceDatabaseExt, SourceRootId, |
33 | }; | 33 | }; |
34 | use ra_syntax::{ | 34 | use ra_syntax::{ |
35 | ast::{self, NameOwner}, | 35 | ast::{self, NameOwner}, |
@@ -40,7 +40,7 @@ use ra_syntax::{ | |||
40 | #[cfg(not(feature = "wasm"))] | 40 | #[cfg(not(feature = "wasm"))] |
41 | use rayon::prelude::*; | 41 | use rayon::prelude::*; |
42 | 42 | ||
43 | use crate::{db::RootDatabase, FileId, Query}; | 43 | use crate::{ide_db::RootDatabase, Query}; |
44 | 44 | ||
45 | #[salsa::query_group(SymbolsDatabaseStorage)] | 45 | #[salsa::query_group(SymbolsDatabaseStorage)] |
46 | pub(crate) trait SymbolsDatabase: hir::db::HirDatabase { | 46 | pub(crate) trait SymbolsDatabase: hir::db::HirDatabase { |
@@ -115,7 +115,7 @@ pub(crate) fn index_resolve(db: &RootDatabase, name_ref: &ast::NameRef) -> Vec<F | |||
115 | let mut query = Query::new(name.to_string()); | 115 | let mut query = Query::new(name.to_string()); |
116 | query.exact(); | 116 | query.exact(); |
117 | query.limit(4); | 117 | query.limit(4); |
118 | crate::symbol_index::world_symbols(db, query) | 118 | world_symbols(db, query) |
119 | } | 119 | } |
120 | 120 | ||
121 | #[derive(Default)] | 121 | #[derive(Default)] |
diff --git a/crates/ra_ide/src/imports_locator.rs b/crates/ra_ide/src/imports_locator.rs index 9e1a1c1ec..9e5e6cadf 100644 --- a/crates/ra_ide/src/imports_locator.rs +++ b/crates/ra_ide/src/imports_locator.rs | |||
@@ -3,8 +3,8 @@ | |||
3 | 3 | ||
4 | use crate::{ | 4 | use crate::{ |
5 | db::RootDatabase, | 5 | db::RootDatabase, |
6 | ide_db::symbol_index::{self, FileSymbol}, | ||
6 | references::{classify_name, NameDefinition, NameKind}, | 7 | references::{classify_name, NameDefinition, NameKind}, |
7 | symbol_index::{self, FileSymbol}, | ||
8 | Query, | 8 | Query, |
9 | }; | 9 | }; |
10 | use hir::{db::HirDatabase, ModuleDef, SourceBinder}; | 10 | use hir::{db::HirDatabase, ModuleDef, SourceBinder}; |
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 003a5e528..3926bc00f 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -14,7 +14,6 @@ mod ide_db; | |||
14 | 14 | ||
15 | mod db; | 15 | mod db; |
16 | pub mod mock_analysis; | 16 | pub mod mock_analysis; |
17 | mod symbol_index; | ||
18 | mod change; | 17 | mod change; |
19 | mod source_change; | 18 | mod source_change; |
20 | 19 | ||
@@ -59,7 +58,11 @@ use ra_db::{ | |||
59 | }; | 58 | }; |
60 | use ra_syntax::{SourceFile, TextRange, TextUnit}; | 59 | use ra_syntax::{SourceFile, TextRange, TextUnit}; |
61 | 60 | ||
62 | use crate::{db::LineIndexDatabase, display::ToNav, symbol_index::FileSymbol}; | 61 | use crate::{ |
62 | db::LineIndexDatabase, | ||
63 | display::ToNav, | ||
64 | ide_db::symbol_index::{self, FileSymbol}, | ||
65 | }; | ||
63 | 66 | ||
64 | pub use crate::{ | 67 | pub use crate::{ |
65 | assists::{Assist, AssistId}, | 68 | assists::{Assist, AssistId}, |
diff --git a/crates/ra_ide/src/status.rs b/crates/ra_ide/src/status.rs index 1bb27eb85..538312086 100644 --- a/crates/ra_ide/src/status.rs +++ b/crates/ra_ide/src/status.rs | |||
@@ -15,7 +15,7 @@ use ra_syntax::{ast, Parse, SyntaxNode}; | |||
15 | 15 | ||
16 | use crate::{ | 16 | use crate::{ |
17 | db::RootDatabase, | 17 | db::RootDatabase, |
18 | symbol_index::{LibrarySymbolsQuery, SymbolIndex}, | 18 | ide_db::symbol_index::{LibrarySymbolsQuery, SymbolIndex}, |
19 | FileId, | 19 | FileId, |
20 | }; | 20 | }; |
21 | 21 | ||