From 00004d85a810a0dbde4607221a85240b50da1019 Mon Sep 17 00:00:00 2001 From: Adam Ward Date: Wed, 8 Jan 2025 11:15:31 -0500 Subject: [PATCH] Some cleanup --- .../LanguageClientIntegration.test.ts | 13 +++----- .../utilities/lsputilities.ts | 31 ------------------- 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/test/integration-tests/language/LanguageClientIntegration.test.ts b/test/integration-tests/language/LanguageClientIntegration.test.ts index 686cefe8..3a2816b8 100644 --- a/test/integration-tests/language/LanguageClientIntegration.test.ts +++ b/test/integration-tests/language/LanguageClientIntegration.test.ts @@ -57,6 +57,10 @@ suite("Language Client Integration Suite @slow", function () { }, }); + setup(async () => { + await waitForIndex(workspaceContext.languageClientManager); + }); + test("Expand Macro", async function () { // Expand Macro support in Swift started from 6.1 if (workspaceContext.swiftVersion.isLessThan(new Version(6, 1, 0))) { @@ -68,18 +72,13 @@ suite("Language Client Integration Suite @slow", function () { await vscode.window.showTextDocument(uri); await workspaceContext.focusFolder(macroFolderContext); - console.log("here 1"); - // Beginning of macro, # const position = new vscode.Position(5, 21); // Create a range starting and ending at the specified position const range = new vscode.Selection(position, position.with({ character: 22 })); - await waitForIndex(workspaceContext.languageClientManager); - console.log("here 2"); await waitForCodeActions(workspaceContext.languageClientManager, uri, range); - console.log("here 3"); // Execute the code action provider command const codeActions = await vscode.commands.executeCommand( @@ -96,8 +95,6 @@ suite("Language Client Integration Suite @slow", function () { // Assert that the expand macro command is available expect(expandMacroAction).is.not.undefined; - console.log("here 4"); - // Set up a promise that resolves when the expected document is opened const expandedMacroUriPromise = new Promise((resolve, reject) => { const disposable = vscode.workspace.onDidOpenTextDocument(openedDocument => { @@ -119,11 +116,9 @@ suite("Language Client Integration Suite @slow", function () { expect(command.arguments).is.not.undefined; const commandArgs = command.arguments!; await vscode.commands.executeCommand(command.command, ...commandArgs); - console.log("here 5"); // Wait for the expanded macro document to be opened const referenceDocument = await expandedMacroUriPromise; - console.log("here 6"); // Verify that the reference document was successfully opened expect(referenceDocument).to.not.be.undefined; diff --git a/test/integration-tests/utilities/lsputilities.ts b/test/integration-tests/utilities/lsputilities.ts index 73bf2647..066b791c 100644 --- a/test/integration-tests/utilities/lsputilities.ts +++ b/test/integration-tests/utilities/lsputilities.ts @@ -58,37 +58,6 @@ export async function waitForClientState( ); } -export async function waitForSymbols( - languageClientManager: LanguageClientManager, - uri: vscode.Uri -): Promise { - let symbols: langclient.DocumentSymbol[] | langclient.SymbolInformation[] = []; - while (symbols?.length === 0) { - symbols = - (await languageClientManager.useLanguageClient(async (client, token) => - client.sendRequest( - langclient.DocumentSymbolRequest.type, - { textDocument: langclient.TextDocumentIdentifier.create(uri.toString()) }, - token - ) - )) || []; - console.warn("Language client is not ready yet. Retrying in 100 ms..."); - await new Promise(resolve => setTimeout(resolve, 100)); - } - return ( - (await waitForClient( - languageClientManager, - async (client, token) => - client.sendRequest( - langclient.DocumentSymbolRequest.type, - { textDocument: langclient.TextDocumentIdentifier.create(uri.toString()) }, - token - ), - s => (s || []).length > 0 - )) || [] - ); -} - export async function waitForCodeActions( languageClientManager: LanguageClientManager, uri: vscode.Uri,