diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 304951b7d..77faf7579 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -1077,8 +1077,16 @@ pub(crate) fn handle_code_action_resolve( | |||
1077 | )?; | 1077 | )?; |
1078 | 1078 | ||
1079 | let assist = &assists[params.index]; | 1079 | let assist = &assists[params.index]; |
1080 | assert!(assist.id.0 == params.id); | 1080 | if assist.id.0 != params.id || assist.id.1 != assist_kind { |
1081 | assert!(assist.id.1 == assist_kind); | 1081 | return Err(LspError::new( |
1082 | ErrorCode::InvalidParams as i32, | ||
1083 | format!( | ||
1084 | "Failed to find exactly the same assist at index {} for the resolve parameters given. Expected id and kind: {}, {:?}, actual id: {:?}.", | ||
1085 | params.index, params.id, assist_kind, assist.id | ||
1086 | ), | ||
1087 | ) | ||
1088 | .into()); | ||
1089 | } | ||
1082 | let edit = to_proto::code_action(&snap, assist.clone(), None)?.edit; | 1090 | let edit = to_proto::code_action(&snap, assist.clone(), None)?.edit; |
1083 | code_action.edit = edit; | 1091 | code_action.edit = edit; |
1084 | Ok(code_action) | 1092 | Ok(code_action) |