aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src/source_change.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_db/src/source_change.rs')
-rw-r--r--crates/ra_ide_db/src/source_change.rs19
1 files changed, 1 insertions, 18 deletions
diff --git a/crates/ra_ide_db/src/source_change.rs b/crates/ra_ide_db/src/source_change.rs
index 94e118dd8..3484f5588 100644
--- a/crates/ra_ide_db/src/source_change.rs
+++ b/crates/ra_ide_db/src/source_change.rs
@@ -3,7 +3,7 @@
3//! 3//!
4//! It can be viewed as a dual for `AnalysisChange`. 4//! It can be viewed as a dual for `AnalysisChange`.
5 5
6use ra_db::{FileId, FilePosition, RelativePathBuf, SourceRootId}; 6use ra_db::{FileId, RelativePathBuf, SourceRootId};
7use ra_text_edit::TextEdit; 7use ra_text_edit::TextEdit;
8 8
9#[derive(Debug, Clone)] 9#[derive(Debug, Clone)]
@@ -12,7 +12,6 @@ pub struct SourceChange {
12 pub label: String, 12 pub label: String,
13 pub source_file_edits: Vec<SourceFileEdit>, 13 pub source_file_edits: Vec<SourceFileEdit>,
14 pub file_system_edits: Vec<FileSystemEdit>, 14 pub file_system_edits: Vec<FileSystemEdit>,
15 pub cursor_position: Option<FilePosition>,
16 pub is_snippet: bool, 15 pub is_snippet: bool,
17} 16}
18 17
@@ -28,7 +27,6 @@ impl SourceChange {
28 label: label.into(), 27 label: label.into(),
29 source_file_edits, 28 source_file_edits,
30 file_system_edits, 29 file_system_edits,
31 cursor_position: None,
32 is_snippet: false, 30 is_snippet: false,
33 } 31 }
34 } 32 }
@@ -42,7 +40,6 @@ impl SourceChange {
42 label: label, 40 label: label,
43 source_file_edits: edits, 41 source_file_edits: edits,
44 file_system_edits: vec![], 42 file_system_edits: vec![],
45 cursor_position: None,
46 is_snippet: false, 43 is_snippet: false,
47 } 44 }
48 } 45 }
@@ -54,7 +51,6 @@ impl SourceChange {
54 label: label.into(), 51 label: label.into(),
55 source_file_edits: vec![], 52 source_file_edits: vec![],
56 file_system_edits: edits, 53 file_system_edits: edits,
57 cursor_position: None,
58 is_snippet: false, 54 is_snippet: false,
59 } 55 }
60 } 56 }
@@ -80,18 +76,6 @@ impl SourceChange {
80 pub fn file_system_edit<L: Into<String>>(label: L, edit: FileSystemEdit) -> Self { 76 pub fn file_system_edit<L: Into<String>>(label: L, edit: FileSystemEdit) -> Self {
81 SourceChange::file_system_edits(label, vec![edit]) 77 SourceChange::file_system_edits(label, vec![edit])
82 } 78 }
83
84 /// Sets the cursor position to the given `FilePosition`
85 pub fn with_cursor(mut self, cursor_position: FilePosition) -> Self {
86 self.cursor_position = Some(cursor_position);
87 self
88 }
89
90 /// Sets the cursor position to the given `FilePosition`
91 pub fn with_cursor_opt(mut self, cursor_position: Option<FilePosition>) -> Self {
92 self.cursor_position = cursor_position;
93 self
94 }
95} 79}
96 80
97#[derive(Debug, Clone)] 81#[derive(Debug, Clone)]
@@ -117,7 +101,6 @@ impl SingleFileChange {
117 label: self.label, 101 label: self.label,
118 source_file_edits: vec![SourceFileEdit { file_id, edit: self.edit }], 102 source_file_edits: vec![SourceFileEdit { file_id, edit: self.edit }],
119 file_system_edits: Vec::new(), 103 file_system_edits: Vec::new(),
120 cursor_position: None,
121 is_snippet: false, 104 is_snippet: false,
122 } 105 }
123 } 106 }