@@ -140,20 +140,20 @@ suite('CodeAction', () => {
140140 disposables . add ( modes . CodeActionProviderRegistry . register ( 'fooLang' , provider ) ) ;
141141
142142 {
143- const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : 'auto' , filter : { kind : new CodeActionKind ( 'a' ) } } , CancellationToken . None ) ;
143+ const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : 'auto' , filter : { include : new CodeActionKind ( 'a' ) } } , CancellationToken . None ) ;
144144 assert . equal ( actions . length , 2 ) ;
145145 assert . strictEqual ( actions [ 0 ] . title , 'a' ) ;
146146 assert . strictEqual ( actions [ 1 ] . title , 'a.b' ) ;
147147 }
148148
149149 {
150- const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : 'auto' , filter : { kind : new CodeActionKind ( 'a.b' ) } } , CancellationToken . None ) ;
150+ const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : 'auto' , filter : { include : new CodeActionKind ( 'a.b' ) } } , CancellationToken . None ) ;
151151 assert . equal ( actions . length , 1 ) ;
152152 assert . strictEqual ( actions [ 0 ] . title , 'a.b' ) ;
153153 }
154154
155155 {
156- const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : 'auto' , filter : { kind : new CodeActionKind ( 'a.b.c' ) } } , CancellationToken . None ) ;
156+ const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : 'auto' , filter : { include : new CodeActionKind ( 'a.b.c' ) } } , CancellationToken . None ) ;
157157 assert . equal ( actions . length , 0 ) ;
158158 }
159159 } ) ;
@@ -172,7 +172,7 @@ suite('CodeAction', () => {
172172
173173 disposables . add ( modes . CodeActionProviderRegistry . register ( 'fooLang' , provider ) ) ;
174174
175- const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : 'auto' , filter : { kind : new CodeActionKind ( 'a' ) } } , CancellationToken . None ) ;
175+ const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : 'auto' , filter : { include : new CodeActionKind ( 'a' ) } } , CancellationToken . None ) ;
176176 assert . equal ( actions . length , 1 ) ;
177177 assert . strictEqual ( actions [ 0 ] . title , 'a' ) ;
178178 } ) ;
@@ -192,12 +192,34 @@ suite('CodeAction', () => {
192192 }
193193
194194 {
195- const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : 'auto' , filter : { kind : CodeActionKind . Source , includeSourceActions : true } } , CancellationToken . None ) ;
195+ const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : 'auto' , filter : { include : CodeActionKind . Source , includeSourceActions : true } } , CancellationToken . None ) ;
196196 assert . equal ( actions . length , 1 ) ;
197197 assert . strictEqual ( actions [ 0 ] . title , 'a' ) ;
198198 }
199199 } ) ;
200200
201+ test ( 'getCodeActions should support filtering out some requested source code actions #84602' , async function ( ) {
202+ const provider = staticCodeActionProvider (
203+ { title : 'a' , kind : CodeActionKind . Source . value } ,
204+ { title : 'b' , kind : CodeActionKind . Source . append ( 'test' ) . value } ,
205+ { title : 'c' , kind : 'c' }
206+ ) ;
207+
208+ disposables . add ( modes . CodeActionProviderRegistry . register ( 'fooLang' , provider ) ) ;
209+
210+ {
211+ const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , {
212+ type : 'auto' , filter : {
213+ include : CodeActionKind . Source . append ( 'test' ) ,
214+ excludes : [ CodeActionKind . Source ] ,
215+ includeSourceActions : true ,
216+ }
217+ } , CancellationToken . None ) ;
218+ assert . equal ( actions . length , 1 ) ;
219+ assert . strictEqual ( actions [ 0 ] . title , 'b' ) ;
220+ }
221+ } ) ;
222+
201223 test ( 'getCodeActions should not invoke code action providers filtered out by providedCodeActionKinds' , async function ( ) {
202224 let wasInvoked = false ;
203225 const provider = new class implements modes . CodeActionProvider {
@@ -214,7 +236,7 @@ suite('CodeAction', () => {
214236 const { actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , {
215237 type : 'auto' ,
216238 filter : {
217- kind : CodeActionKind . QuickFix
239+ include : CodeActionKind . QuickFix
218240 }
219241 } , CancellationToken . None ) ;
220242 assert . strictEqual ( actions . length , 0 ) ;
0 commit comments