diff options
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 65e8bc856..3893430c0 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -35,6 +35,7 @@ use crate::{ | |||
35 | TryConvWithToVec, | 35 | TryConvWithToVec, |
36 | }, | 36 | }, |
37 | diagnostics::DiagnosticTask, | 37 | diagnostics::DiagnosticTask, |
38 | from_json, | ||
38 | req::{self, Decoration, InlayHint, InlayHintsParams, InlayKind}, | 39 | req::{self, Decoration, InlayHint, InlayHintsParams, InlayKind}, |
39 | world::WorldSnapshot, | 40 | world::WorldSnapshot, |
40 | LspError, Result, | 41 | LspError, Result, |
@@ -589,6 +590,7 @@ pub fn handle_formatting( | |||
589 | let end_position = TextUnit::of_str(&file).conv_with(&file_line_index); | 590 | let end_position = TextUnit::of_str(&file).conv_with(&file_line_index); |
590 | 591 | ||
591 | let mut rustfmt = process::Command::new("rustfmt"); | 592 | let mut rustfmt = process::Command::new("rustfmt"); |
593 | rustfmt.args(&world.options.rustfmt_args); | ||
592 | if let Some(&crate_id) = crate_ids.first() { | 594 | if let Some(&crate_id) = crate_ids.first() { |
593 | // Assume all crates are in the same edition | 595 | // Assume all crates are in the same edition |
594 | let edition = world.analysis().crate_edition(crate_id)?; | 596 | let edition = world.analysis().crate_edition(crate_id)?; |
@@ -757,7 +759,7 @@ pub fn handle_code_lens( | |||
757 | // Gather runnables | 759 | // Gather runnables |
758 | for runnable in world.analysis().runnables(file_id)? { | 760 | for runnable in world.analysis().runnables(file_id)? { |
759 | let title = match &runnable.kind { | 761 | let title = match &runnable.kind { |
760 | RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => "▶️Run Test", | 762 | RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => "▶️\u{fe0e}Run Test", |
761 | RunnableKind::Bench { .. } => "Run Bench", | 763 | RunnableKind::Bench { .. } => "Run Bench", |
762 | RunnableKind::Bin => "Run", | 764 | RunnableKind::Bin => "Run", |
763 | } | 765 | } |
@@ -811,7 +813,7 @@ enum CodeLensResolveData { | |||
811 | pub fn handle_code_lens_resolve(world: WorldSnapshot, code_lens: CodeLens) -> Result<CodeLens> { | 813 | pub fn handle_code_lens_resolve(world: WorldSnapshot, code_lens: CodeLens) -> Result<CodeLens> { |
812 | let _p = profile("handle_code_lens_resolve"); | 814 | let _p = profile("handle_code_lens_resolve"); |
813 | let data = code_lens.data.unwrap(); | 815 | let data = code_lens.data.unwrap(); |
814 | let resolve = serde_json::from_value(data)?; | 816 | let resolve = from_json::<Option<CodeLensResolveData>>("CodeLensResolveData", data)?; |
815 | match resolve { | 817 | match resolve { |
816 | Some(CodeLensResolveData::Impls(lens_params)) => { | 818 | Some(CodeLensResolveData::Impls(lens_params)) => { |
817 | let locations: Vec<Location> = | 819 | let locations: Vec<Location> = |
@@ -917,9 +919,9 @@ fn to_lsp_runnable( | |||
917 | let args = runnable_args(world, file_id, &runnable.kind)?; | 919 | let args = runnable_args(world, file_id, &runnable.kind)?; |
918 | let line_index = world.analysis().file_line_index(file_id)?; | 920 | let line_index = world.analysis().file_line_index(file_id)?; |
919 | let label = match &runnable.kind { | 921 | let label = match &runnable.kind { |
920 | RunnableKind::Test { name } => format!("test {}", name), | 922 | RunnableKind::Test { test_id } => format!("test {}", test_id), |
921 | RunnableKind::TestMod { path } => format!("test-mod {}", path), | 923 | RunnableKind::TestMod { path } => format!("test-mod {}", path), |
922 | RunnableKind::Bench { name } => format!("bench {}", name), | 924 | RunnableKind::Bench { test_id } => format!("bench {}", test_id), |
923 | RunnableKind::Bin => "run binary".to_string(), | 925 | RunnableKind::Bin => "run binary".to_string(), |
924 | }; | 926 | }; |
925 | Ok(req::Runnable { | 927 | Ok(req::Runnable { |