File tree Expand file tree Collapse file tree 1 file changed +23
-8
lines changed
Expand file tree Collapse file tree 1 file changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -2090,19 +2090,34 @@ impl LspCommand for GetCodeActions {
20902090 server_id : LanguageServerId ,
20912091 _: AsyncAppContext ,
20922092 ) -> Result < Vec < CodeAction > > {
2093+ let requested_kinds_set = if let Some ( kinds) = self . kinds {
2094+ Some ( kinds. into_iter ( ) . collect :: < HashSet < _ > > ( ) )
2095+ } else {
2096+ None
2097+ } ;
2098+
20932099 Ok ( actions
20942100 . unwrap_or_default ( )
20952101 . into_iter ( )
20962102 . filter_map ( |entry| {
2097- if let lsp:: CodeActionOrCommand :: CodeAction ( lsp_action) = entry {
2098- Some ( CodeAction {
2099- server_id,
2100- range : self . range . clone ( ) ,
2101- lsp_action,
2102- } )
2103- } else {
2104- None
2103+ let lsp_action = match entry {
2104+ lsp:: CodeActionOrCommand :: CodeAction ( lsp_action) => lsp_action,
2105+ _ => return None ,
2106+ } ;
2107+
2108+ if let Some ( requested_kinds) = & requested_kinds_set {
2109+ if let Some ( kind) = & lsp_action. kind {
2110+ if !requested_kinds. contains ( kind) {
2111+ return None ;
2112+ }
2113+ }
21052114 }
2115+
2116+ Some ( CodeAction {
2117+ server_id,
2118+ range : self . range . clone ( ) ,
2119+ lsp_action,
2120+ } )
21062121 } )
21072122 . collect ( ) )
21082123 }
You can’t perform that action at this time.
0 commit comments