diff options
Diffstat (limited to 'crates/server/src/req.rs')
-rw-r--r-- | crates/server/src/req.rs | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/crates/server/src/req.rs b/crates/server/src/req.rs index 881069b1f..c6d2f2efb 100644 --- a/crates/server/src/req.rs +++ b/crates/server/src/req.rs | |||
@@ -15,6 +15,7 @@ pub use languageserver_types::{ | |||
15 | TextEdit, | 15 | TextEdit, |
16 | CompletionParams, CompletionResponse, | 16 | CompletionParams, CompletionResponse, |
17 | DocumentOnTypeFormattingParams, | 17 | DocumentOnTypeFormattingParams, |
18 | TextDocumentEdit, | ||
18 | }; | 19 | }; |
19 | 20 | ||
20 | 21 | ||
@@ -115,14 +116,6 @@ pub struct Decoration { | |||
115 | pub tag: &'static str | 116 | pub tag: &'static str |
116 | } | 117 | } |
117 | 118 | ||
118 | pub enum MoveCursor {} | ||
119 | |||
120 | impl Request for MoveCursor { | ||
121 | type Params = Position; | ||
122 | type Result = (); | ||
123 | const METHOD: &'static str = "m/moveCursor"; | ||
124 | } | ||
125 | |||
126 | pub enum ParentModule {} | 119 | pub enum ParentModule {} |
127 | 120 | ||
128 | impl Request for ParentModule { | 121 | impl Request for ParentModule { |
@@ -135,7 +128,7 @@ pub enum JoinLines {} | |||
135 | 128 | ||
136 | impl Request for JoinLines { | 129 | impl Request for JoinLines { |
137 | type Params = JoinLinesParams; | 130 | type Params = JoinLinesParams; |
138 | type Result = Vec<TextEdit>; | 131 | type Result = SourceChange; |
139 | const METHOD: &'static str = "m/joinLines"; | 132 | const METHOD: &'static str = "m/joinLines"; |
140 | } | 133 | } |
141 | 134 | ||
@@ -170,3 +163,27 @@ pub struct Runnable { | |||
170 | pub args: Vec<String>, | 163 | pub args: Vec<String>, |
171 | pub env: HashMap<String, String>, | 164 | pub env: HashMap<String, String>, |
172 | } | 165 | } |
166 | |||
167 | #[derive(Serialize, Debug)] | ||
168 | #[serde(rename_all = "camelCase")] | ||
169 | pub struct SourceChange { | ||
170 | pub label: String, | ||
171 | pub source_file_edits: Vec<TextDocumentEdit>, | ||
172 | pub file_system_edits: Vec<FileSystemEdit>, | ||
173 | pub cursor_position: Option<TextDocumentPositionParams>, | ||
174 | } | ||
175 | |||
176 | #[derive(Serialize, Debug)] | ||
177 | #[serde(tag = "type", rename_all = "camelCase")] | ||
178 | pub enum FileSystemEdit { | ||
179 | CreateFile { | ||
180 | #[serde(with = "url_serde")] | ||
181 | uri: Url | ||
182 | }, | ||
183 | MoveFile { | ||
184 | #[serde(with = "url_serde")] | ||
185 | src: Url, | ||
186 | #[serde(with = "url_serde")] | ||
187 | dst: Url, | ||
188 | } | ||
189 | } | ||