diff --git a/integration/vscode/ada/test/runTest.ts b/integration/vscode/ada/test/runTest.ts index 5fe7e3623..374a1b62f 100644 --- a/integration/vscode/ada/test/runTest.ts +++ b/integration/vscode/ada/test/runTest.ts @@ -3,6 +3,7 @@ import os from 'os'; import { runTests } from '@vscode/test-electron'; import { TestOptions } from '@vscode/test-electron/out/runTest'; +import { mkdtemp } from 'fs'; async function main() { // The folder containing the Extension Manifest package.json @@ -28,37 +29,52 @@ async function main() { `test/workspaces/${testsuite}` ); - const testOptions: TestOptions = { - extensionDevelopmentPath, - extensionTestsPath, - // --user-data-dir is set to the OS default directory for temporary files to avoid - // warnings related to longs paths in IPC sockets created by VSCode. - launchArgs: ['--user-data-dir', `${os.tmpdir()}`, testWorkspace], - }; - if (process.env.VSCODE) { - // If specified, use the VSCode executable provided externally. This - // can be use to test with an externally installed VS Code version - // such as in a CI environment for example. - // - // The expected value is the path to /code and not - // /bin/code. - testOptions.vscodeExecutablePath = process.env.VSCODE; - } else { - // Otherwise download the latest stable version and test using that. - testOptions.version = 'stable'; - } + await new Promise((resolve) => { + mkdtemp(`${os.tmpdir()}/vsc-ada-test-`, (err, folder) => { + if (err) throw err; + + const testOptions: TestOptions = { + extensionDevelopmentPath: extensionDevelopmentPath, + extensionTestsPath: extensionTestsPath, + // --user-data-dir is set to a unique dirctory under the OS + // default tmp directory for temporary files to avoid + // warnings related to longs paths in IPC sockets created by + // VSCode. The directory is made unique to avoid + // interference between successive runs. + launchArgs: ['--user-data-dir', folder, testWorkspace], + }; + if (process.env.VSCODE) { + // If specified, use the VSCode executable provided externally. This + // can be use to test with an externally installed VS Code version + // such as in a CI environment for example. + // + // The expected value is the path to /code and not + // /bin/code. + testOptions.vscodeExecutablePath = process.env.VSCODE; + } else { + // Otherwise download the latest stable version and test using that. + testOptions.version = 'stable'; + } - // Catch any errors running this testsuite, but continue running the remaining ones. - try { - // Download and unzip VS Code (if it has not been done before), and run this testsuite. - await runTests(testOptions); - } catch (err) { - console.error(err); - console.error(`Failed to run ${testsuite} testsuite`); - // If this testsuite failed, flag it so that we can exit with a non zero error code - // later. - someTestsuiteFailed = true; - } + console.info('Calling runTests with: ' + JSON.stringify(testOptions, undefined, 2)); + // Download and unzip VS Code (if it has not been done before), + // and run this testsuite. + runTests(testOptions) + .then(() => { + resolve(); + }) + .catch((err) => { + // Catch any errors running this testsuite, to continue + // running the remaining testsuites. + console.error(err); + console.error(`Failed to run ${testsuite} testsuite`); + // If this testsuite failed, flag it so that we can exit + // with a non zero error code later. + someTestsuiteFailed = true; + resolve(); + }); + }); + }); } if (someTestsuiteFailed) { diff --git a/integration/vscode/ada/test/suite/utils.ts b/integration/vscode/ada/test/suite/utils.ts index d6a96af58..de59b69ed 100644 --- a/integration/vscode/ada/test/suite/utils.ts +++ b/integration/vscode/ada/test/suite/utils.ts @@ -1,10 +1,10 @@ -import * as vscode from 'vscode'; import assert from 'assert'; -import { env } from 'process'; -import path, { resolve } from 'path'; -import Mocha, { MochaOptions } from 'mocha'; -import { Glob, GlobOptionsWithFileTypesUnset } from 'glob'; import { existsSync, readFileSync, writeFileSync } from 'fs'; +import { Glob, GlobOptionsWithFileTypesUnset } from 'glob'; +import Mocha, { MochaOptions } from 'mocha'; +import path from 'path'; +import { env } from 'process'; +import * as vscode from 'vscode'; /** * This function compares some actual output to an expected referenced stored in @@ -89,11 +89,11 @@ export function runMochaTestsuite(suiteName: string, suiteDirectory: string) { // Create the mocha test const mocha = new Mocha(mochaOptions); - return new Promise((c, e) => { + return new Promise((resolve, reject) => { const globOptions: GlobOptionsWithFileTypesUnset = { cwd: suiteDirectory }; const glob = new Glob('**/*.test.js', globOptions); for (const file of glob) { - mocha.addFile(resolve(suiteDirectory, file)); + mocha.addFile(path.resolve(suiteDirectory, file)); } try { // This variable is set in the launch configuration (launch.json) of @@ -110,13 +110,13 @@ export function runMochaTestsuite(suiteName: string, suiteDirectory: string) { // Run the mocha test mocha.run((failures) => { if (failures > 0) { - e(new Error(`${failures} tests failed.`)); + reject(new Error(`${failures} tests failed.`)); } else { - c(); + resolve(); } }); } catch (err) { - e(err); + reject(err); } }); } diff --git a/source/gpr/lsp-gpr_completions.adb b/source/gpr/lsp-gpr_completions.adb index 439abbe53..c0e358e77 100644 --- a/source/gpr/lsp-gpr_completions.adb +++ b/source/gpr/lsp-gpr_completions.adb @@ -268,7 +268,8 @@ package body LSP.GPR_Completions is end Fill_Completion_Response; procedure Fill_Completion_Resolve_Response - (Response : in out LSP.Structures.CompletionItem) is + (Response : in out LSP.Structures.CompletionItem) + is Pack : Package_Id; Attr : Q_Optional_Attribute_Id; Doc_Text : VSS.Strings.Virtual_String; diff --git a/source/protocol/generated/lsp-message_io.adb b/source/protocol/generated/lsp-message_io.adb index 74c66c5ae..9b3abb846 100644 --- a/source/protocol/generated/lsp-message_io.adb +++ b/source/protocol/generated/lsp-message_io.adb @@ -7080,7 +7080,7 @@ package body LSP.Message_IO is elsif Key = "command" then Optional_Command'Read (S, V.command); elsif Key = "data" then - Optional_Location'Read (S, V.data); + Optional_LSP_Any'Read (S, V.data); else JS.Skip_Value; end if; @@ -7130,7 +7130,7 @@ package body LSP.Message_IO is JS.Key ("command"); Optional_Command'Write (S, V.command); JS.Key ("data"); - Optional_Location'Write (S, V.data); + Optional_LSP_Any'Write (S, V.data); JS.End_Object; end Write_CompletionItem; diff --git a/source/protocol/lsp-messages.ads b/source/protocol/lsp-messages.ads index 1f99bc813..cb06af95f 100644 --- a/source/protocol/lsp-messages.ads +++ b/source/protocol/lsp-messages.ads @@ -7625,7 +7625,7 @@ package LSP.Messages is additionalTextEdits : TextEdit_Vector; commitCharacters : Optional_Virtual_String_Vector; command : Optional_Command; - data : Optional_Location; + data : Optional_LSP_Any; end record; procedure Read_CompletionItem