@@ -13,10 +13,12 @@ import {
13
13
expectText ,
14
14
openFileInWorkspaceAsync ,
15
15
} from './integrationHelpers' ;
16
+ import { CSharpExtensionExports } from '../../../src/csharpExtensionExports' ;
16
17
17
18
describe ( `Code Actions Tests` , ( ) => {
19
+ let csharpExports : CSharpExtensionExports | undefined = undefined ;
18
20
beforeAll ( async ( ) => {
19
- await activateCSharpExtension ( ) ;
21
+ csharpExports = await activateCSharpExtension ( ) ;
20
22
} ) ;
21
23
22
24
beforeEach ( async ( ) => {
@@ -34,7 +36,11 @@ describe(`Code Actions Tests`, () => {
34
36
35
37
test ( 'Lightbulb displays actions' , async ( ) => {
36
38
console . log ( 'LIGHTBULB TEST' ) ;
39
+ csharpExports ! . experimental . outputChannel . appendLine ( 'Lightbulb displays actions' ) ;
40
+ csharpExports ! . experimental . traceChannel . appendLine ( 'Lightbulb displays actions' ) ;
37
41
const actions = await getCodeActions ( new vscode . Range ( 0 , 0 , 0 , 12 ) ) ;
42
+ csharpExports ! . experimental . traceChannel . appendLine ( `Got actions ${ actions . length } ` ) ;
43
+ csharpExports ! . experimental . traceChannel . appendLine ( JSON . stringify ( actions , null , 4 ) ) ;
38
44
expect ( actions . length ) . toBeGreaterThanOrEqual ( 3 ) ;
39
45
console . log ( actions . length ) ;
40
46
console . log ( actions . map ( ( a ) => a . title ) . join ( ', ' ) ) ;
@@ -314,22 +320,18 @@ async function getCodeActions(
314
320
range : vscode . Range ,
315
321
resolveCount : number | undefined = undefined
316
322
) : Promise < vscode . CodeAction [ ] > {
323
+ const uri = vscode . window . activeTextEditor ! . document . uri ;
324
+ console . log ( `Getting actions for ${ uri . toString ( ) } ` ) ;
317
325
const codeActions = await vscode . commands . executeCommand < vscode . CodeAction [ ] > (
318
326
'vscode.executeCodeActionProvider' ,
319
- vscode . window . activeTextEditor ! . document . uri ,
327
+ uri ,
320
328
range ,
321
329
/** kind **/ undefined ,
322
330
resolveCount
323
331
) ;
324
332
325
333
console . log ( JSON . stringify ( codeActions , null , 4 ) ) ;
326
334
327
- const moreAction = codeActions . find ( ( a ) => a . title === 'More...' ) ;
328
- if ( moreAction ) {
329
- console . log ( 'More actions available' ) ;
330
- console . log ( JSON . stringify ( moreAction , null , 4 ) ) ;
331
- }
332
-
333
335
return codeActions ;
334
336
}
335
337
0 commit comments