diff options
Diffstat (limited to 'crates/ra_ide_api/src/lib.rs')
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 1f43b7623..2d090d9b4 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -90,15 +90,8 @@ pub struct SourceFileEdit { | |||
90 | 90 | ||
91 | #[derive(Debug)] | 91 | #[derive(Debug)] |
92 | pub enum FileSystemEdit { | 92 | pub enum FileSystemEdit { |
93 | CreateFile { | 93 | CreateFile { source_root: SourceRootId, path: RelativePathBuf }, |
94 | source_root: SourceRootId, | 94 | MoveFile { src: FileId, dst_source_root: SourceRootId, dst_path: RelativePathBuf }, |
95 | path: RelativePathBuf, | ||
96 | }, | ||
97 | MoveFile { | ||
98 | src: FileId, | ||
99 | dst_source_root: SourceRootId, | ||
100 | dst_path: RelativePathBuf, | ||
101 | }, | ||
102 | } | 95 | } |
103 | 96 | ||
104 | #[derive(Debug)] | 97 | #[derive(Debug)] |
@@ -179,9 +172,7 @@ impl AnalysisHost { | |||
179 | /// Returns a snapshot of the current state, which you can query for | 172 | /// Returns a snapshot of the current state, which you can query for |
180 | /// semantic information. | 173 | /// semantic information. |
181 | pub fn analysis(&self) -> Analysis { | 174 | pub fn analysis(&self) -> Analysis { |
182 | Analysis { | 175 | Analysis { db: self.db.snapshot() } |
183 | db: self.db.snapshot(), | ||
184 | } | ||
185 | } | 176 | } |
186 | 177 | ||
187 | /// Applies changes to the current state of the world. If there are | 178 | /// Applies changes to the current state of the world. If there are |
@@ -401,17 +392,12 @@ impl Analysis { | |||
401 | 392 | ||
402 | impl SourceChange { | 393 | impl SourceChange { |
403 | pub(crate) fn from_local_edit(file_id: FileId, edit: LocalEdit) -> SourceChange { | 394 | pub(crate) fn from_local_edit(file_id: FileId, edit: LocalEdit) -> SourceChange { |
404 | let file_edit = SourceFileEdit { | 395 | let file_edit = SourceFileEdit { file_id, edit: edit.edit }; |
405 | file_id, | ||
406 | edit: edit.edit, | ||
407 | }; | ||
408 | SourceChange { | 396 | SourceChange { |
409 | label: edit.label, | 397 | label: edit.label, |
410 | source_file_edits: vec![file_edit], | 398 | source_file_edits: vec![file_edit], |
411 | file_system_edits: vec![], | 399 | file_system_edits: vec![], |
412 | cursor_position: edit | 400 | cursor_position: edit.cursor_position.map(|offset| FilePosition { offset, file_id }), |
413 | .cursor_position | ||
414 | .map(|offset| FilePosition { offset, file_id }), | ||
415 | } | 401 | } |
416 | } | 402 | } |
417 | } | 403 | } |