15
15
import * as assert from "assert" ;
16
16
import * as vscode from "vscode" ;
17
17
import { CommentCompletionProviders } from "../../../src/editor/CommentCompletion" ;
18
- import { Workbench } from "../../../src/utilities/commands" ;
19
18
20
19
suite ( "CommentCompletion Test Suite" , ( ) => {
21
20
let provider : CommentCompletionProviders ;
@@ -223,7 +222,12 @@ suite("CommentCompletion Test Suite", () => {
223
222
] ) ;
224
223
} ) ;
225
224
226
- test ( "Comment insertion" , async ( ) => {
225
+ test ( "Comment insertion" , async function ( ) {
226
+ if ( process . platform === "linux" ) {
227
+ // Linux tests are having issues with open text editors
228
+ this . skip ( ) ;
229
+ }
230
+
227
231
const { document, positions } = await openDocument ( `
228
232
/// 1️⃣
229
233
func foo(bar: Int, baz: String) -> Data throws { return Data() }` ) ;
@@ -393,12 +397,6 @@ suite("CommentCompletion Test Suite", () => {
393
397
} ) ;
394
398
395
399
suite ( "Document Comment Completion" , function ( ) {
396
- setup ( function ( ) {
397
- if ( process . platform === "linux" ) {
398
- // Skip as these tests access the active test editor which will sometimes crash on Linux.
399
- this . skip ( ) ;
400
- }
401
- } ) ;
402
400
test ( "Should not provide completions on first line" , async ( ) => {
403
401
const { document, positions } = await openDocument ( `1️⃣
404
402
public func foo() {}` ) ;
@@ -473,27 +471,6 @@ public func foo() {}`);
473
471
assert . deepEqual ( documentText , originalText , "Document text should not change" ) ;
474
472
} ) ;
475
473
476
- test ( "Should handle case when no active text editor" , async ( ) => {
477
- const { document : doc , positions } = await openDocument ( `
478
- /// aaa
479
- 1️⃣
480
- public func foo() {}` ) ;
481
-
482
- const position = positions [ "1️⃣" ] ;
483
-
484
- // Close all editors to simulate no active text editor
485
- await vscode . commands . executeCommand ( Workbench . ACTION_CLOSEALLEDITORS ) ;
486
-
487
- // This should not throw an error
488
- const items = await provider . docCommentCompletion . provideCompletionItems ( doc , position ) ;
489
-
490
- assert . equal (
491
- items ,
492
- undefined ,
493
- "Should not provide completions when no active text editor"
494
- ) ;
495
- } ) ;
496
-
497
474
test ( "Should handle when previous line has // but not ///" , async ( ) => {
498
475
const { document, positions } = await openDocument ( `
499
476
// aaa
@@ -521,9 +498,6 @@ public func foo() {}`);
521
498
522
499
const position = positions [ "1️⃣" ] ;
523
500
524
- // Show the document to ensure there's an active editor
525
- await vscode . window . showTextDocument ( document ) ;
526
-
527
501
const items = await provider . docCommentCompletion . provideCompletionItems (
528
502
document ,
529
503
position
@@ -545,9 +519,6 @@ public func foo() {}`);
545
519
546
520
const position = positions [ "1️⃣" ] ;
547
521
548
- // Show the document to ensure there's an active editor
549
- await vscode . window . showTextDocument ( document ) ;
550
-
551
522
const originalText = document . getText ( ) ;
552
523
const items = await provider . docCommentCompletion . provideCompletionItems (
553
524
document ,
@@ -609,8 +580,6 @@ public func foo() {}`);
609
580
content : purgedContent ,
610
581
} ) ;
611
582
612
- await vscode . window . showTextDocument ( doc ) ;
613
-
614
583
return { document : doc , positions } ;
615
584
}
616
585
} ) ;
0 commit comments