diff options
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index a51a9293f..83b3a343c 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -8,8 +8,9 @@ use std::{ | |||
8 | }; | 8 | }; |
9 | 9 | ||
10 | use ide::{ | 10 | use ide::{ |
11 | CompletionResolveCapability, FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, | 11 | AssistConfig, CompletionResolveCapability, FileId, FilePosition, FileRange, HoverAction, |
12 | NavigationTarget, Query, RangeInfo, Runnable, RunnableKind, SearchScope, SymbolKind, TextEdit, | 12 | HoverGotoTypeData, NavigationTarget, Query, RangeInfo, Runnable, RunnableKind, SearchScope, |
13 | SymbolKind, TextEdit, | ||
13 | }; | 14 | }; |
14 | use itertools::Itertools; | 15 | use itertools::Itertools; |
15 | use lsp_server::ErrorCode; | 16 | use lsp_server::ErrorCode; |
@@ -882,11 +883,14 @@ pub(crate) fn handle_code_action( | |||
882 | let range = from_proto::text_range(&line_index, params.range); | 883 | let range = from_proto::text_range(&line_index, params.range); |
883 | let frange = FileRange { file_id, range }; | 884 | let frange = FileRange { file_id, range }; |
884 | 885 | ||
885 | snap.config.assist.allowed = params | 886 | let assists_config = AssistConfig { |
886 | .clone() | 887 | allowed: params |
887 | .context | 888 | .clone() |
888 | .only | 889 | .context |
889 | .map(|it| it.into_iter().filter_map(from_proto::assist_kind).collect()); | 890 | .only |
891 | .map(|it| it.into_iter().filter_map(from_proto::assist_kind).collect()), | ||
892 | ..snap.config.assist | ||
893 | }; | ||
890 | 894 | ||
891 | let mut res: Vec<lsp_ext::CodeAction> = Vec::new(); | 895 | let mut res: Vec<lsp_ext::CodeAction> = Vec::new(); |
892 | 896 | ||
@@ -894,12 +898,12 @@ pub(crate) fn handle_code_action( | |||
894 | 898 | ||
895 | if snap.config.client_caps.code_action_resolve { | 899 | if snap.config.client_caps.code_action_resolve { |
896 | for (index, assist) in | 900 | for (index, assist) in |
897 | snap.analysis.unresolved_assists(&snap.config.assist, frange)?.into_iter().enumerate() | 901 | snap.analysis.unresolved_assists(&assists_config, frange)?.into_iter().enumerate() |
898 | { | 902 | { |
899 | res.push(to_proto::unresolved_code_action(&snap, params.clone(), assist, index)?); | 903 | res.push(to_proto::unresolved_code_action(&snap, params.clone(), assist, index)?); |
900 | } | 904 | } |
901 | } else { | 905 | } else { |
902 | for assist in snap.analysis.resolved_assists(&snap.config.assist, frange)?.into_iter() { | 906 | for assist in snap.analysis.resolved_assists(&assists_config, frange)?.into_iter() { |
903 | res.push(to_proto::resolved_code_action(&snap, assist)?); | 907 | res.push(to_proto::resolved_code_action(&snap, assist)?); |
904 | } | 908 | } |
905 | } | 909 | } |