aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2021-05-03 17:35:44 +0100
committerKirill Bulatov <[email protected]>2021-05-03 17:35:44 +0100
commit90fc32937785b3f17899f14d8cb2f7b3738a9850 (patch)
treebf08a9fb84231de75ca7cf494df3d6caebbcbe62 /crates
parent3eab6ce2e3eef6c8dca1127b4c1375899bf13b8c (diff)
Index retrieval fix
Diffstat (limited to 'crates')
-rw-r--r--crates/ide_assists/src/lib.rs2
-rw-r--r--crates/rust-analyzer/src/handlers.rs12
2 files changed, 12 insertions, 2 deletions
diff --git a/crates/ide_assists/src/lib.rs b/crates/ide_assists/src/lib.rs
index 723531078..2e0c58504 100644
--- a/crates/ide_assists/src/lib.rs
+++ b/crates/ide_assists/src/lib.rs
@@ -102,7 +102,7 @@ pub enum AssistResolveStrategy {
102 None, 102 None,
103 /// All assists should be resolved. 103 /// All assists should be resolved.
104 All, 104 All,
105 /// Only a certain assists should be resolved. 105 /// Only a certain assist should be resolved.
106 Single(SingleResolve), 106 Single(SingleResolve),
107} 107}
108 108
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 77faf7579..0fd03bbaa 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -1076,7 +1076,17 @@ pub(crate) fn handle_code_action_resolve(
1076 frange, 1076 frange,
1077 )?; 1077 )?;
1078 1078
1079 let assist = &assists[params.index]; 1079 let assist = match assists.get(params.index) {
1080 Some(assist) => assist,
1081 None => return Err(LspError::new(
1082 ErrorCode::InvalidParams as i32,
1083 format!(
1084 "Failed to find the assist for index {} provided by the resolve request. Expected assist id: {:?}",
1085 params.index, params.id,
1086 ),
1087 )
1088 .into())
1089 };
1080 if assist.id.0 != params.id || assist.id.1 != assist_kind { 1090 if assist.id.0 != params.id || assist.id.1 != assist_kind {
1081 return Err(LspError::new( 1091 return Err(LspError::new(
1082 ErrorCode::InvalidParams as i32, 1092 ErrorCode::InvalidParams as i32,