diff options
-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.rs | 21 |
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 @@ | |||
1 | use hir::{ | 1 | use hir::{Problem, source_binder}; |
2 | self, Problem, source_binder | 2 | use ra_ide_api_light::Severity; |
3 | }; | ||
4 | use ra_ide_api_light::{self, LocalEdit, Severity}; | ||
5 | use ra_db::SourceDatabase; | 3 | use ra_db::SourceDatabase; |
6 | 4 | ||
7 | use crate::{ | 5 | use crate::{db, Diagnostic, FileId, FileSystemEdit, SourceChange}; |
8 | db, Diagnostic, FileId, FilePosition, FileSystemEdit, | ||
9 | SourceChange, SourceFileEdit, | ||
10 | }; | ||
11 | 6 | ||
12 | impl db::RootDatabase { | 7 | impl 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 | |||
78 | impl 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 | ||
16 | mod db; | 16 | mod db; |
17 | mod imp; | ||
18 | pub mod mock_analysis; | 17 | pub mod mock_analysis; |
19 | mod symbol_index; | 18 | mod symbol_index; |
20 | mod navigation_target; | 19 | mod navigation_target; |
@@ -32,6 +31,7 @@ mod parent_module; | |||
32 | mod references; | 31 | mod references; |
33 | mod impls; | 32 | mod impls; |
34 | mod assists; | 33 | mod assists; |
34 | mod diagnostics; | ||
35 | 35 | ||
36 | #[cfg(test)] | 36 | #[cfg(test)] |
37 | mod marks; | 37 | mod marks; |
@@ -58,7 +58,7 @@ pub use crate::{ | |||
58 | change::{AnalysisChange, LibraryData}, | 58 | change::{AnalysisChange, LibraryData}, |
59 | }; | 59 | }; |
60 | pub use ra_ide_api_light::{ | 60 | pub 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 | }; |
64 | pub use ra_db::{ | 64 | pub use ra_db::{ |
@@ -399,6 +399,23 @@ impl Analysis { | |||
399 | } | 399 | } |
400 | } | 400 | } |
401 | 401 | ||
402 | impl 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] |
403 | fn analysis_is_send() { | 420 | fn analysis_is_send() { |
404 | fn is_send<T: Send>() {} | 421 | fn is_send<T: Send>() {} |