@@ -42,30 +42,39 @@ suite(`${OmniSharpCompletionProvider.name}: Returns the completion items`, () =>
4242 expect ( completionList . items ) . to . not . be . empty ;
4343 } ) ;
4444
45- test ( "Preselect is enabled for at least one completionItem when there is a new" , async ( ) => {
46- let completionList = < vscode . CompletionList > ( await vscode . commands . executeCommand ( "vscode.executeCompletionItemProvider" , fileUri , new vscode . Position ( 8 , 31 ) , " " ) ) ;
47- let preselectList = completionList . items . filter ( item => item . preselect === true ) ;
48- expect ( preselectList ) . to . not . be . empty ;
49- } ) ;
50-
5145 test ( "Resolve adds documentation" , async ( ) => {
52- let completionList = < vscode . CompletionList > ( await vscode . commands . executeCommand ( "vscode.executeCompletionItemProvider" , fileUri , new vscode . Position ( 8 , 31 ) , " " , 10 ) ) ;
46+ let completionList = < vscode . CompletionList > ( await vscode . commands . executeCommand ( "vscode.executeCompletionItemProvider" , fileUri , new vscode . Position ( 8 , 31 ) , /*trigger character*/ undefined , /* completions to resolve */ 10 ) ) ;
5347 // At least some of the first 10 fully-resolved elements should have documentation attached. If this ever ends up not being
5448 // true, adjust the cutoff appropriately.
5549 const documentation = completionList . items . slice ( 0 , 9 ) . filter ( item => item . documentation ) ;
5650 expect ( documentation ) . to . not . be . empty ;
5751 } ) ;
5852
59- test ( "Override completion has additional edits" , async ( ) => {
60- let completionList = < vscode . CompletionList > ( await vscode . commands . executeCommand ( "vscode.executeCompletionItemProvider" , fileUri , new vscode . Position ( 11 , 17 ) , " " ) ) ;
53+ test ( "Override completion has additional edits sync " , async ( ) => {
54+ let completionList = < vscode . CompletionList > ( await vscode . commands . executeCommand ( "vscode.executeCompletionItemProvider" , fileUri , new vscode . Position ( 11 , 17 ) , " " , 4 ) ) ;
6155 const nonSnippets = completionList . items . filter ( c => c . kind != vscode . CompletionItemKind . Snippet ) ;
56+
57+ let sawAdditionalTextEdits = false ;
58+ let sawEmptyAdditionalTextEdits = false ;
59+
6260 for ( const i of nonSnippets ) {
6361 expect ( ( < vscode . SnippetString > i . insertText ) . value ) . contains ( "$0" ) ;
64- expect ( i . additionalTextEdits ) . is . not . null ;
65- expect ( i . additionalTextEdits [ 0 ] . range . start . line ) . equals ( 11 ) ;
66- expect ( i . additionalTextEdits [ 0 ] . range . start . character ) . equals ( 8 ) ;
67- expect ( i . additionalTextEdits [ 0 ] . range . end . line ) . equals ( 11 ) ;
68- expect ( i . additionalTextEdits [ 0 ] . range . end . character ) . equals ( 16 ) ;
62+ if ( i . additionalTextEdits ) {
63+ sawAdditionalTextEdits = true ;
64+ expect ( i . additionalTextEdits ) . to . be . array ( ) ;
65+ expect ( i . additionalTextEdits . length ) . to . equal ( 1 ) ;
66+ expect ( i . additionalTextEdits [ 0 ] . newText ) . to . equal ( "using singleCsproj2;\n" ) ;
67+ expect ( i . additionalTextEdits [ 0 ] . range . start . line ) . to . equal ( 1 ) ;
68+ expect ( i . additionalTextEdits [ 0 ] . range . start . character ) . to . equal ( 0 ) ;
69+ expect ( i . additionalTextEdits [ 0 ] . range . end . line ) . to . equal ( 1 ) ;
70+ expect ( i . additionalTextEdits [ 0 ] . range . end . character ) . to . equal ( 1 ) ;
71+ }
72+ else {
73+ sawEmptyAdditionalTextEdits = true ;
74+ }
6975 }
76+
77+ expect ( sawAdditionalTextEdits ) . to . be . true ;
78+ expect ( sawEmptyAdditionalTextEdits ) . to . be . true ;
7079 } ) ;
7180} ) ;
0 commit comments