@@ -8,7 +8,7 @@ import { URI } from 'vs/base/common/uri';
88import { Range } from 'vs/editor/common/core/range' ;
99import { TextModel } from 'vs/editor/common/model/textModel' ;
1010import * as modes from 'vs/editor/common/modes' ;
11- import { getCodeActions } from 'vs/editor/contrib/codeAction/codeAction' ;
11+ import { CodeActionItem , getCodeActions } from 'vs/editor/contrib/codeAction/codeAction' ;
1212import { CodeActionKind } from 'vs/editor/contrib/codeAction/types' ;
1313import { IMarkerData , MarkerSeverity } from 'vs/platform/markers/common/markers' ;
1414import { CancellationToken } from 'vs/base/common/cancellation' ;
@@ -117,14 +117,14 @@ suite('CodeAction', () => {
117117
118118 const expected = [
119119 // CodeActions with a diagnostics array are shown first ordered by diagnostics.message
120- testData . diagnostics . abc ,
121- testData . diagnostics . bcd ,
120+ new CodeActionItem ( testData . diagnostics . abc , provider ) ,
121+ new CodeActionItem ( testData . diagnostics . bcd , provider ) ,
122122
123123 // CodeActions without diagnostics are shown in the given order without any further sorting
124- testData . command . abc ,
125- testData . spelling . bcd , // empty diagnostics array
126- testData . tsLint . bcd ,
127- testData . tsLint . abc
124+ new CodeActionItem ( testData . command . abc , provider ) ,
125+ new CodeActionItem ( testData . spelling . bcd , provider ) , // empty diagnostics array
126+ new CodeActionItem ( testData . tsLint . bcd , provider ) ,
127+ new CodeActionItem ( testData . tsLint . abc , provider )
128128 ] ;
129129
130130 const { validActions : actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : modes . CodeActionTriggerType . Manual } , Progress . None , CancellationToken . None ) ;
@@ -144,14 +144,14 @@ suite('CodeAction', () => {
144144 {
145145 const { validActions : actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : modes . CodeActionTriggerType . Auto , filter : { include : new CodeActionKind ( 'a' ) } } , Progress . None , CancellationToken . None ) ;
146146 assert . equal ( actions . length , 2 ) ;
147- assert . strictEqual ( actions [ 0 ] . title , 'a' ) ;
148- assert . strictEqual ( actions [ 1 ] . title , 'a.b' ) ;
147+ assert . strictEqual ( actions [ 0 ] . action . title , 'a' ) ;
148+ assert . strictEqual ( actions [ 1 ] . action . title , 'a.b' ) ;
149149 }
150150
151151 {
152152 const { validActions : actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : modes . CodeActionTriggerType . Auto , filter : { include : new CodeActionKind ( 'a.b' ) } } , Progress . None , CancellationToken . None ) ;
153153 assert . equal ( actions . length , 1 ) ;
154- assert . strictEqual ( actions [ 0 ] . title , 'a.b' ) ;
154+ assert . strictEqual ( actions [ 0 ] . action . title , 'a.b' ) ;
155155 }
156156
157157 {
@@ -176,7 +176,7 @@ suite('CodeAction', () => {
176176
177177 const { validActions : actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : modes . CodeActionTriggerType . Auto , filter : { include : new CodeActionKind ( 'a' ) } } , Progress . None , CancellationToken . None ) ;
178178 assert . equal ( actions . length , 1 ) ;
179- assert . strictEqual ( actions [ 0 ] . title , 'a' ) ;
179+ assert . strictEqual ( actions [ 0 ] . action . title , 'a' ) ;
180180 } ) ;
181181
182182 test ( 'getCodeActions should not return source code action by default' , async function ( ) {
@@ -190,13 +190,13 @@ suite('CodeAction', () => {
190190 {
191191 const { validActions : actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : modes . CodeActionTriggerType . Auto } , Progress . None , CancellationToken . None ) ;
192192 assert . equal ( actions . length , 1 ) ;
193- assert . strictEqual ( actions [ 0 ] . title , 'b' ) ;
193+ assert . strictEqual ( actions [ 0 ] . action . title , 'b' ) ;
194194 }
195195
196196 {
197197 const { validActions : actions } = await getCodeActions ( model , new Range ( 1 , 1 , 2 , 1 ) , { type : modes . CodeActionTriggerType . Auto , filter : { include : CodeActionKind . Source , includeSourceActions : true } } , Progress . None , CancellationToken . None ) ;
198198 assert . equal ( actions . length , 1 ) ;
199- assert . strictEqual ( actions [ 0 ] . title , 'a' ) ;
199+ assert . strictEqual ( actions [ 0 ] . action . title , 'a' ) ;
200200 }
201201 } ) ;
202202
@@ -218,7 +218,7 @@ suite('CodeAction', () => {
218218 }
219219 } , Progress . None , CancellationToken . None ) ;
220220 assert . equal ( actions . length , 1 ) ;
221- assert . strictEqual ( actions [ 0 ] . title , 'b' ) ;
221+ assert . strictEqual ( actions [ 0 ] . action . title , 'b' ) ;
222222 }
223223 } ) ;
224224
@@ -255,7 +255,7 @@ suite('CodeAction', () => {
255255 } , Progress . None , CancellationToken . None ) ;
256256 assert . strictEqual ( didInvoke , false ) ;
257257 assert . equal ( actions . length , 1 ) ;
258- assert . strictEqual ( actions [ 0 ] . title , 'a' ) ;
258+ assert . strictEqual ( actions [ 0 ] . action . title , 'a' ) ;
259259 }
260260 } ) ;
261261
@@ -282,4 +282,3 @@ suite('CodeAction', () => {
282282 assert . strictEqual ( wasInvoked , false ) ;
283283 } ) ;
284284} ) ;
285-
0 commit comments