Index retrieval fix

This commit is contained in:
Kirill Bulatov 2021-05-03 19:35:44 +03:00
parent 3eab6ce2e3
commit 90fc329377
2 changed files with 12 additions and 2 deletions

View file

@ -102,7 +102,7 @@ pub enum AssistResolveStrategy {
None,
/// All assists should be resolved.
All,
/// Only a certain assists should be resolved.
/// Only a certain assist should be resolved.
Single(SingleResolve),
}

View file

@ -1076,7 +1076,17 @@ pub(crate) fn handle_code_action_resolve(
frange,
)?;
let assist = &assists[params.index];
let assist = match assists.get(params.index) {
Some(assist) => assist,
None => return Err(LspError::new(
ErrorCode::InvalidParams as i32,
format!(
"Failed to find the assist for index {} provided by the resolve request. Expected assist id: {:?}",
params.index, params.id,
),
)
.into())
};
if assist.id.0 != params.id || assist.id.1 != assist_kind {
return Err(LspError::new(
ErrorCode::InvalidParams as i32,