@@ -20,10 +20,8 @@ import { WorkspaceContext } from "../../../src/WorkspaceContext";
20
20
import { testAssetUri } from "../../fixtures" ;
21
21
import { executeTaskAndWaitForResult , waitForNoRunningTasks } from "../../utilities/tasks" ;
22
22
import { getBuildAllTask , SwiftTask } from "../../../src/tasks/SwiftTaskProvider" ;
23
- import { Version } from "../../../src/utilities/version" ;
24
23
import { activateExtensionForSuite , folderInRootWorkspace } from "../utilities/testutilities" ;
25
- import { FolderContext } from "../../../src/FolderContext" ;
26
- import { waitForClientState , waitForCodeActions , waitForIndex } from "../utilities/lsputilities" ;
24
+ import { waitForClientState , waitForIndex } from "../utilities/lsputilities" ;
27
25
28
26
async function buildProject ( ctx : WorkspaceContext , name : string ) {
29
27
await waitForNoRunningTasks ( ) ;
@@ -35,20 +33,15 @@ async function buildProject(ctx: WorkspaceContext, name: string) {
35
33
}
36
34
37
35
suite ( "Language Client Integration Suite @slow" , function ( ) {
38
- this . timeout ( 5 * 60 * 1000 ) ;
36
+ this . timeout ( 2 * 60 * 1000 ) ;
39
37
40
38
let clientManager : LanguageClientManager ;
41
39
let workspaceContext : WorkspaceContext ;
42
- let macroFolderContext : FolderContext ;
43
40
44
41
activateExtensionForSuite ( {
45
42
async setup ( ctx ) {
46
43
workspaceContext = ctx ;
47
44
48
- // Wait for a clean starting point, and build all tasks for the fixture
49
- if ( workspaceContext . swiftVersion . isGreaterThanOrEqual ( new Version ( 6 , 1 , 0 ) ) ) {
50
- macroFolderContext = await buildProject ( ctx , "swift-macro" ) ;
51
- }
52
45
await buildProject ( ctx , "defaultPackage" ) ;
53
46
54
47
// Ensure lsp client is ready
@@ -61,74 +54,6 @@ suite("Language Client Integration Suite @slow", function () {
61
54
await waitForIndex ( workspaceContext . languageClientManager ) ;
62
55
} ) ;
63
56
64
- test ( "Expand Macro" , async function ( ) {
65
- // Expand Macro support in Swift started from 6.1
66
- if ( workspaceContext . swiftVersion . isLessThan ( new Version ( 6 , 1 , 0 ) ) ) {
67
- this . skip ( ) ;
68
- }
69
-
70
- // Focus on the file of interest
71
- const uri = testAssetUri ( "swift-macro/Sources/swift-macroClient/main.swift" ) ;
72
- await vscode . window . showTextDocument ( uri ) ;
73
- await workspaceContext . focusFolder ( macroFolderContext ) ;
74
-
75
- // Beginning of macro, #
76
- const position = new vscode . Position ( 5 , 21 ) ;
77
-
78
- // Create a range starting and ending at the specified position
79
- const range = new vscode . Selection ( position , position . with ( { character : 22 } ) ) ;
80
-
81
- await waitForCodeActions ( workspaceContext . languageClientManager , uri , range ) ;
82
-
83
- // Execute the code action provider command
84
- const codeActions = await vscode . commands . executeCommand < vscode . CodeAction [ ] > (
85
- "vscode.executeCodeActionProvider" ,
86
- uri ,
87
- range
88
- ) ;
89
-
90
- // Find the "expand.macro.command" action
91
- const expandMacroAction = codeActions . find (
92
- action => action . command ?. command === "expand.macro.command"
93
- ) ;
94
-
95
- // Assert that the expand macro command is available
96
- expect ( expandMacroAction ) . is . not . undefined ;
97
-
98
- // Set up a promise that resolves when the expected document is opened
99
- const expandedMacroUriPromise = new Promise < vscode . TextDocument > ( ( resolve , reject ) => {
100
- const disposable = vscode . workspace . onDidOpenTextDocument ( openedDocument => {
101
- if ( openedDocument . uri . scheme === "sourcekit-lsp" ) {
102
- disposable . dispose ( ) ; // Stop listening once we find the desired document
103
- resolve ( openedDocument ) ;
104
- }
105
- } ) ;
106
-
107
- // Set a timeout to reject the promise if the document is not found
108
- setTimeout ( ( ) => {
109
- disposable . dispose ( ) ;
110
- reject ( new Error ( "Timed out waiting for sourcekit-lsp document to be opened." ) ) ;
111
- } , 10000 ) ; // Wait up to 10 seconds for the document
112
- } ) ;
113
-
114
- // Run expand macro action
115
- const command = expandMacroAction ! . command ! ;
116
- expect ( command . arguments ) . is . not . undefined ;
117
- const commandArgs = command . arguments ! ;
118
- await vscode . commands . executeCommand ( command . command , ...commandArgs ) ;
119
-
120
- // Wait for the expanded macro document to be opened
121
- const referenceDocument = await expandedMacroUriPromise ;
122
-
123
- // Verify that the reference document was successfully opened
124
- expect ( referenceDocument ) . to . not . be . undefined ;
125
-
126
- // Assert that the content contains the expected result
127
- const expectedMacro = '(a + b, "a + b")' ;
128
- const content = referenceDocument . getText ( ) ;
129
- expect ( content ) . to . include ( expectedMacro ) ;
130
- } ) ;
131
-
132
57
suite ( "Symbols" , ( ) => {
133
58
const uri = testAssetUri ( "defaultPackage/Sources/PackageExe/main.swift" ) ;
134
59
const expectedDefinitionUri = testAssetUri (
0 commit comments