aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-02-08 11:24:39 +0000
committerAleksey Kladov <[email protected]>2019-02-08 11:34:30 +0000
commit8328e196dd093f85e51420fa27d9d9bcdf65e866 (patch)
tree6fea69cad7871bdf32c18666625c9a9312a6c297
parente4a6343e47a7dc87192b762b3b2ebd100240d194 (diff)
move diagnostics to a separate file
-rw-r--r--crates/ra_ide_api/src/diagnostics.rs (renamed from crates/ra_ide_api/src/imp.rs)28
-rw-r--r--crates/ra_ide_api/src/lib.rs21
2 files changed, 22 insertions, 27 deletions
diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/diagnostics.rs
index a351c9373..c6ca91af8 100644
--- a/crates/ra_ide_api/src/imp.rs
+++ b/crates/ra_ide_api/src/diagnostics.rs
@@ -1,13 +1,8 @@
1use hir::{ 1use hir::{Problem, source_binder};
2 self, Problem, source_binder 2use ra_ide_api_light::Severity;
3};
4use ra_ide_api_light::{self, LocalEdit, Severity};
5use ra_db::SourceDatabase; 3use ra_db::SourceDatabase;
6 4
7use crate::{ 5use crate::{db, Diagnostic, FileId, FileSystemEdit, SourceChange};
8 db, Diagnostic, FileId, FilePosition, FileSystemEdit,
9 SourceChange, SourceFileEdit,
10};
11 6
12impl db::RootDatabase { 7impl db::RootDatabase {
13 pub(crate) fn diagnostics(&self, file_id: FileId) -> Vec<Diagnostic> { 8 pub(crate) fn diagnostics(&self, file_id: FileId) -> Vec<Diagnostic> {
@@ -74,20 +69,3 @@ impl db::RootDatabase {
74 res 69 res
75 } 70 }
76} 71}
77
78impl SourceChange {
79 pub(crate) fn from_local_edit(file_id: FileId, edit: LocalEdit) -> SourceChange {
80 let file_edit = SourceFileEdit {
81 file_id,
82 edit: edit.edit,
83 };
84 SourceChange {
85 label: edit.label,
86 source_file_edits: vec![file_edit],
87 file_system_edits: vec![],
88 cursor_position: edit
89 .cursor_position
90 .map(|offset| FilePosition { offset, file_id }),
91 }
92 }
93}
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index f5c1aa036..312b11a82 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -14,7 +14,6 @@
14#![recursion_limit = "128"] 14#![recursion_limit = "128"]
15 15
16mod db; 16mod db;
17mod imp;
18pub mod mock_analysis; 17pub mod mock_analysis;
19mod symbol_index; 18mod symbol_index;
20mod navigation_target; 19mod navigation_target;
@@ -32,6 +31,7 @@ mod parent_module;
32mod references; 31mod references;
33mod impls; 32mod impls;
34mod assists; 33mod assists;
34mod diagnostics;
35 35
36#[cfg(test)] 36#[cfg(test)]
37mod marks; 37mod marks;
@@ -58,7 +58,7 @@ pub use crate::{
58 change::{AnalysisChange, LibraryData}, 58 change::{AnalysisChange, LibraryData},
59}; 59};
60pub use ra_ide_api_light::{ 60pub use ra_ide_api_light::{
61 Fold, FoldKind, HighlightedRange, Severity, StructureNode, 61 Fold, FoldKind, HighlightedRange, Severity, StructureNode, LocalEdit,
62 LineIndex, LineCol, translate_offset_with_edit, 62 LineIndex, LineCol, translate_offset_with_edit,
63}; 63};
64pub use ra_db::{ 64pub use ra_db::{
@@ -399,6 +399,23 @@ impl Analysis {
399 } 399 }
400} 400}
401 401
402impl SourceChange {
403 pub(crate) fn from_local_edit(file_id: FileId, edit: LocalEdit) -> SourceChange {
404 let file_edit = SourceFileEdit {
405 file_id,
406 edit: edit.edit,
407 };
408 SourceChange {
409 label: edit.label,
410 source_file_edits: vec![file_edit],
411 file_system_edits: vec![],
412 cursor_position: edit
413 .cursor_position
414 .map(|offset| FilePosition { offset, file_id }),
415 }
416 }
417}
418
402#[test] 419#[test]
403fn analysis_is_send() { 420fn analysis_is_send() {
404 fn is_send<T: Send>() {} 421 fn is_send<T: Send>() {}