aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs
index a3361d6dc..6acf80c58 100644
--- a/crates/rust-analyzer/src/main_loop/handlers.rs
+++ b/crates/rust-analyzer/src/main_loop/handlers.rs
@@ -25,7 +25,7 @@ use ra_project_model::TargetKind;
25use ra_syntax::{AstNode, SyntaxKind, TextRange, TextSize}; 25use ra_syntax::{AstNode, SyntaxKind, TextRange, TextSize};
26use serde::{Deserialize, Serialize}; 26use serde::{Deserialize, Serialize};
27use serde_json::to_value; 27use serde_json::to_value;
28use stdx::format_to; 28use stdx::{format_to, split1};
29 29
30use crate::{ 30use crate::{
31 cargo_target_spec::CargoTargetSpec, 31 cargo_target_spec::CargoTargetSpec,
@@ -786,11 +786,10 @@ pub fn handle_resolve_code_action(
786 let frange = FileRange { file_id, range }; 786 let frange = FileRange { file_id, range };
787 787
788 let assists = snap.analysis().resolved_assists(&snap.config.assist, frange)?; 788 let assists = snap.analysis().resolved_assists(&snap.config.assist, frange)?;
789 let id_components = params.id.split(":").collect::<Vec<&str>>(); 789 let (id_string, index) = split1(&params.id, ':').unwrap();
790 let index = id_components.last().unwrap().parse::<usize>().unwrap(); 790 let index = index.parse::<usize>().unwrap();
791 let id_string = id_components.first().unwrap();
792 let assist = &assists[index]; 791 let assist = &assists[index];
793 assert!(assist.assist.id.0 == *id_string); 792 assert!(assist.assist.id.0 == id_string);
794 Ok(to_proto::resolved_code_action(&snap, assist.clone())?.edit) 793 Ok(to_proto::resolved_code_action(&snap, assist.clone())?.edit)
795} 794}
796 795