Skip to content

Commit 04c4892

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents fdc3f69 + 03a19f5 commit 04c4892

File tree

5 files changed

+61
-44
lines changed

5 files changed

+61
-44
lines changed

integration/vscode/ada/test/runTest.ts

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import os from 'os';
33

44
import { runTests } from '@vscode/test-electron';
55
import { TestOptions } from '@vscode/test-electron/out/runTest';
6+
import { mkdtemp } from 'fs';
67

78
async function main() {
89
// The folder containing the Extension Manifest package.json
@@ -28,37 +29,52 @@ async function main() {
2829
`test/workspaces/${testsuite}`
2930
);
3031

31-
const testOptions: TestOptions = {
32-
extensionDevelopmentPath,
33-
extensionTestsPath,
34-
// --user-data-dir is set to the OS default directory for temporary files to avoid
35-
// warnings related to longs paths in IPC sockets created by VSCode.
36-
launchArgs: ['--user-data-dir', `${os.tmpdir()}`, testWorkspace],
37-
};
38-
if (process.env.VSCODE) {
39-
// If specified, use the VSCode executable provided externally. This
40-
// can be use to test with an externally installed VS Code version
41-
// such as in a CI environment for example.
42-
//
43-
// The expected value is the path to <install-dir>/code and not
44-
// <install-dir>/bin/code.
45-
testOptions.vscodeExecutablePath = process.env.VSCODE;
46-
} else {
47-
// Otherwise download the latest stable version and test using that.
48-
testOptions.version = 'stable';
49-
}
32+
await new Promise<void>((resolve) => {
33+
mkdtemp(`${os.tmpdir()}/vsc-ada-test-`, (err, folder) => {
34+
if (err) throw err;
35+
36+
const testOptions: TestOptions = {
37+
extensionDevelopmentPath: extensionDevelopmentPath,
38+
extensionTestsPath: extensionTestsPath,
39+
// --user-data-dir is set to a unique dirctory under the OS
40+
// default tmp directory for temporary files to avoid
41+
// warnings related to longs paths in IPC sockets created by
42+
// VSCode. The directory is made unique to avoid
43+
// interference between successive runs.
44+
launchArgs: ['--user-data-dir', folder, testWorkspace],
45+
};
46+
if (process.env.VSCODE) {
47+
// If specified, use the VSCode executable provided externally. This
48+
// can be use to test with an externally installed VS Code version
49+
// such as in a CI environment for example.
50+
//
51+
// The expected value is the path to <install-dir>/code and not
52+
// <install-dir>/bin/code.
53+
testOptions.vscodeExecutablePath = process.env.VSCODE;
54+
} else {
55+
// Otherwise download the latest stable version and test using that.
56+
testOptions.version = 'stable';
57+
}
5058

51-
// Catch any errors running this testsuite, but continue running the remaining ones.
52-
try {
53-
// Download and unzip VS Code (if it has not been done before), and run this testsuite.
54-
await runTests(testOptions);
55-
} catch (err) {
56-
console.error(err);
57-
console.error(`Failed to run ${testsuite} testsuite`);
58-
// If this testsuite failed, flag it so that we can exit with a non zero error code
59-
// later.
60-
someTestsuiteFailed = true;
61-
}
59+
console.info('Calling runTests with: ' + JSON.stringify(testOptions, undefined, 2));
60+
// Download and unzip VS Code (if it has not been done before),
61+
// and run this testsuite.
62+
runTests(testOptions)
63+
.then(() => {
64+
resolve();
65+
})
66+
.catch((err) => {
67+
// Catch any errors running this testsuite, to continue
68+
// running the remaining testsuites.
69+
console.error(err);
70+
console.error(`Failed to run ${testsuite} testsuite`);
71+
// If this testsuite failed, flag it so that we can exit
72+
// with a non zero error code later.
73+
someTestsuiteFailed = true;
74+
resolve();
75+
});
76+
});
77+
});
6278
}
6379

6480
if (someTestsuiteFailed) {

integration/vscode/ada/test/suite/utils.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import * as vscode from 'vscode';
21
import assert from 'assert';
3-
import { env } from 'process';
4-
import path, { resolve } from 'path';
5-
import Mocha, { MochaOptions } from 'mocha';
6-
import { Glob, GlobOptionsWithFileTypesUnset } from 'glob';
72
import { existsSync, readFileSync, writeFileSync } from 'fs';
3+
import { Glob, GlobOptionsWithFileTypesUnset } from 'glob';
4+
import Mocha, { MochaOptions } from 'mocha';
5+
import path from 'path';
6+
import { env } from 'process';
7+
import * as vscode from 'vscode';
88

99
/**
1010
* This function compares some actual output to an expected referenced stored in
@@ -89,11 +89,11 @@ export function runMochaTestsuite(suiteName: string, suiteDirectory: string) {
8989
// Create the mocha test
9090
const mocha = new Mocha(mochaOptions);
9191

92-
return new Promise<void>((c, e) => {
92+
return new Promise<void>((resolve, reject) => {
9393
const globOptions: GlobOptionsWithFileTypesUnset = { cwd: suiteDirectory };
9494
const glob = new Glob('**/*.test.js', globOptions);
9595
for (const file of glob) {
96-
mocha.addFile(resolve(suiteDirectory, file));
96+
mocha.addFile(path.resolve(suiteDirectory, file));
9797
}
9898
try {
9999
// This variable is set in the launch configuration (launch.json) of
@@ -110,13 +110,13 @@ export function runMochaTestsuite(suiteName: string, suiteDirectory: string) {
110110
// Run the mocha test
111111
mocha.run((failures) => {
112112
if (failures > 0) {
113-
e(new Error(`${failures} tests failed.`));
113+
reject(new Error(`${failures} tests failed.`));
114114
} else {
115-
c();
115+
resolve();
116116
}
117117
});
118118
} catch (err) {
119-
e(err);
119+
reject(err);
120120
}
121121
});
122122
}

source/gpr/lsp-gpr_completions.adb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ package body LSP.GPR_Completions is
268268
end Fill_Completion_Response;
269269

270270
procedure Fill_Completion_Resolve_Response
271-
(Response : in out LSP.Structures.CompletionItem) is
271+
(Response : in out LSP.Structures.CompletionItem)
272+
is
272273
Pack : Package_Id;
273274
Attr : Q_Optional_Attribute_Id;
274275
Doc_Text : VSS.Strings.Virtual_String;

source/protocol/generated/lsp-message_io.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7080,7 +7080,7 @@ package body LSP.Message_IO is
70807080
elsif Key = "command" then
70817081
Optional_Command'Read (S, V.command);
70827082
elsif Key = "data" then
7083-
Optional_Location'Read (S, V.data);
7083+
Optional_LSP_Any'Read (S, V.data);
70847084
else
70857085
JS.Skip_Value;
70867086
end if;
@@ -7130,7 +7130,7 @@ package body LSP.Message_IO is
71307130
JS.Key ("command");
71317131
Optional_Command'Write (S, V.command);
71327132
JS.Key ("data");
7133-
Optional_Location'Write (S, V.data);
7133+
Optional_LSP_Any'Write (S, V.data);
71347134
JS.End_Object;
71357135
end Write_CompletionItem;
71367136

source/protocol/lsp-messages.ads

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7625,7 +7625,7 @@ package LSP.Messages is
76257625
additionalTextEdits : TextEdit_Vector;
76267626
commitCharacters : Optional_Virtual_String_Vector;
76277627
command : Optional_Command;
7628-
data : Optional_Location;
7628+
data : Optional_LSP_Any;
76297629
end record;
76307630

76317631
procedure Read_CompletionItem

0 commit comments

Comments
 (0)