diff options
-rw-r--r-- | crates/rust-analyzer/src/lsp_ext.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/tests/heavy_tests/main.rs | 52 |
2 files changed, 16 insertions, 38 deletions
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs index c7a3a6911..f75a26eb7 100644 --- a/crates/rust-analyzer/src/lsp_ext.rs +++ b/crates/rust-analyzer/src/lsp_ext.rs | |||
@@ -206,7 +206,9 @@ pub struct CodeAction { | |||
206 | #[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] | 206 | #[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
207 | #[serde(rename_all = "camelCase")] | 207 | #[serde(rename_all = "camelCase")] |
208 | pub struct SnippetWorkspaceEdit { | 208 | pub struct SnippetWorkspaceEdit { |
209 | #[serde(skip_serializing_if = "Option::is_none")] | ||
209 | pub changes: Option<HashMap<lsp_types::Url, Vec<lsp_types::TextEdit>>>, | 210 | pub changes: Option<HashMap<lsp_types::Url, Vec<lsp_types::TextEdit>>>, |
211 | #[serde(skip_serializing_if = "Option::is_none")] | ||
210 | pub document_changes: Option<Vec<SnippetDocumentChangeOperation>>, | 212 | pub document_changes: Option<Vec<SnippetDocumentChangeOperation>>, |
211 | } | 213 | } |
212 | 214 | ||
diff --git a/crates/rust-analyzer/tests/heavy_tests/main.rs b/crates/rust-analyzer/tests/heavy_tests/main.rs index 5011cc273..74676b3ee 100644 --- a/crates/rust-analyzer/tests/heavy_tests/main.rs +++ b/crates/rust-analyzer/tests/heavy_tests/main.rs | |||
@@ -333,29 +333,17 @@ fn main() {} | |||
333 | partial_result_params: PartialResultParams::default(), | 333 | partial_result_params: PartialResultParams::default(), |
334 | work_done_progress_params: WorkDoneProgressParams::default(), | 334 | work_done_progress_params: WorkDoneProgressParams::default(), |
335 | }, | 335 | }, |
336 | json!([ | 336 | json!([{ |
337 | { | 337 | "edit": { |
338 | "command": { | 338 | "documentChanges": [ |
339 | "arguments": [ | ||
340 | { | 339 | { |
341 | "cursorPosition": null, | 340 | "kind": "create", |
342 | "label": "Create module", | 341 | "uri": "file:///[..]/src/bar.rs" |
343 | "workspaceEdit": { | ||
344 | "documentChanges": [ | ||
345 | { | ||
346 | "kind": "create", | ||
347 | "uri": "file:///[..]/src/bar.rs" | ||
348 | } | ||
349 | ] | ||
350 | } | ||
351 | } | 342 | } |
352 | ], | 343 | ] |
353 | "command": "rust-analyzer.applySourceChange", | ||
354 | "title": "Create module" | ||
355 | }, | 344 | }, |
356 | "title": "Create module" | 345 | "title": "Create module" |
357 | } | 346 | }]), |
358 | ]), | ||
359 | ); | 347 | ); |
360 | 348 | ||
361 | server.request::<CodeActionRequest>( | 349 | server.request::<CodeActionRequest>( |
@@ -416,29 +404,17 @@ fn main() {{}} | |||
416 | partial_result_params: PartialResultParams::default(), | 404 | partial_result_params: PartialResultParams::default(), |
417 | work_done_progress_params: WorkDoneProgressParams::default(), | 405 | work_done_progress_params: WorkDoneProgressParams::default(), |
418 | }, | 406 | }, |
419 | json!([ | 407 | json!([{ |
420 | { | 408 | "edit": { |
421 | "command": { | 409 | "documentChanges": [ |
422 | "arguments": [ | ||
423 | { | 410 | { |
424 | "cursorPosition": null, | 411 | "kind": "create", |
425 | "label": "Create module", | 412 | "uri": "file://[..]/src/bar.rs" |
426 | "workspaceEdit": { | ||
427 | "documentChanges": [ | ||
428 | { | ||
429 | "kind": "create", | ||
430 | "uri": "file:///[..]/src/bar.rs" | ||
431 | } | ||
432 | ] | ||
433 | } | ||
434 | } | 413 | } |
435 | ], | 414 | ] |
436 | "command": "rust-analyzer.applySourceChange", | ||
437 | "title": "Create module" | ||
438 | }, | 415 | }, |
439 | "title": "Create module" | 416 | "title": "Create module" |
440 | } | 417 | }]), |
441 | ]), | ||
442 | ); | 418 | ); |
443 | 419 | ||
444 | server.request::<CodeActionRequest>( | 420 | server.request::<CodeActionRequest>( |