diff options
author | Aleksey Kladov <[email protected]> | 2019-01-08 18:00:51 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-08 18:03:42 +0000 |
commit | 695294bbb974cdbac136e260029403e90a17d953 (patch) | |
tree | caa02f8086ad15fb6f884e56bc6a0231b203215f /crates/ra_analysis/src/lib.rs | |
parent | 0c88360eb46c44935421c5d4bc36910ce3e96782 (diff) |
ra_db is independent from editor
Diffstat (limited to 'crates/ra_analysis/src/lib.rs')
-rw-r--r-- | crates/ra_analysis/src/lib.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index a3b350ad7..48df08416 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs | |||
@@ -29,12 +29,16 @@ use std::{fmt, sync::Arc}; | |||
29 | 29 | ||
30 | use ra_syntax::{SmolStr, SourceFile, TreePtr, SyntaxKind, TextRange, TextUnit}; | 30 | use ra_syntax::{SmolStr, SourceFile, TreePtr, SyntaxKind, TextRange, TextUnit}; |
31 | use ra_text_edit::TextEdit; | 31 | use ra_text_edit::TextEdit; |
32 | use ra_db::{SyntaxDatabase, FilesDatabase, LocalSyntaxPtr}; | ||
32 | use rayon::prelude::*; | 33 | use rayon::prelude::*; |
33 | use relative_path::RelativePathBuf; | 34 | use relative_path::RelativePathBuf; |
34 | use rustc_hash::FxHashMap; | 35 | use rustc_hash::FxHashMap; |
35 | use salsa::ParallelDatabase; | 36 | use salsa::ParallelDatabase; |
36 | 37 | ||
37 | use crate::symbol_index::{FileSymbol, SymbolIndex}; | 38 | use crate::{ |
39 | symbol_index::{FileSymbol, SymbolIndex}, | ||
40 | db::LineIndexDatabase, | ||
41 | }; | ||
38 | 42 | ||
39 | pub use crate::{ | 43 | pub use crate::{ |
40 | completion::{CompletionItem, CompletionItemKind, InsertText}, | 44 | completion::{CompletionItem, CompletionItemKind, InsertText}, |
@@ -44,10 +48,8 @@ pub use ra_editor::{ | |||
44 | Fold, FoldKind, HighlightedRange, Severity, StructureNode, | 48 | Fold, FoldKind, HighlightedRange, Severity, StructureNode, |
45 | LineIndex, LineCol, translate_offset_with_edit, | 49 | LineIndex, LineCol, translate_offset_with_edit, |
46 | }; | 50 | }; |
47 | |||
48 | pub use ra_db::{ | 51 | pub use ra_db::{ |
49 | Cancelable, Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, FilesDatabase, | 52 | Cancelable, Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId |
50 | LocalSyntaxPtr, SourceRootId, SyntaxDatabase, | ||
51 | }; | 53 | }; |
52 | 54 | ||
53 | #[derive(Default)] | 55 | #[derive(Default)] |
@@ -325,7 +327,7 @@ impl Analysis { | |||
325 | /// Gets the file's `LineIndex`: data structure to convert between absolute | 327 | /// Gets the file's `LineIndex`: data structure to convert between absolute |
326 | /// offsets and line/column representation. | 328 | /// offsets and line/column representation. |
327 | pub fn file_line_index(&self, file_id: FileId) -> Arc<LineIndex> { | 329 | pub fn file_line_index(&self, file_id: FileId) -> Arc<LineIndex> { |
328 | self.db.file_lines(file_id) | 330 | self.db.line_index(file_id) |
329 | } | 331 | } |
330 | /// Selects the next syntactic nodes encopasing the range. | 332 | /// Selects the next syntactic nodes encopasing the range. |
331 | pub fn extend_selection(&self, frange: FileRange) -> TextRange { | 333 | pub fn extend_selection(&self, frange: FileRange) -> TextRange { |