Skip to content

Commit a341b1b

Browse files
committed
Changes to support updating vscode-languageclient from 7.0.0 to 9.0.1
1 parent 62c8173 commit a341b1b

File tree

11 files changed

+439
-310
lines changed

11 files changed

+439
-310
lines changed

integration/vscode/ada/package-lock.json

Lines changed: 414 additions & 286 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/vscode/ada/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"publisher": "AdaCore",
77
"license": "GPL-3.0",
88
"engines": {
9-
"vscode": "^1.71.2"
9+
"vscode": "^1.83.1"
1010
},
1111
"categories": [
1212
"Programming Languages",
@@ -16,8 +16,6 @@
1616
"ms-vscode.cpptools"
1717
],
1818
"activationEvents": [
19-
"onLanguage:ada",
20-
"onLanguage:gpr",
2119
"workspaceContains:*.gpr",
2220
"workspaceContains:*/*.gpr",
2321
"workspaceContains:*.ad[bs]",
@@ -856,7 +854,7 @@
856854
"devDependencies": {
857855
"@types/mocha": "10.0.1",
858856
"@types/node": "16.18.16",
859-
"@types/vscode": "1.71.0",
857+
"@types/vscode": "1.83.3",
860858
"@types/ws": "8.5.4",
861859
"@typescript-eslint/eslint-plugin": "5.54.0",
862860
"@typescript-eslint/parser": "5.55.0",
@@ -891,8 +889,8 @@
891889
"fast-xml-parser": "4.2.5",
892890
"fp-ts": "2.12.0",
893891
"process": "0.11.10",
894-
"vscode-languageclient": "7.0.0",
892+
"vscode-languageclient": "9.0.1",
895893
"winston": "3.10.0",
896894
"ws": "8.13.0"
897895
}
898-
}
896+
}

integration/vscode/ada/src/ExtensionState.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export class ExtensionState {
2020
public readonly gprClient: LanguageClient;
2121
public readonly context: vscode.ExtensionContext;
2222

23-
private clientsDisposables: Disposable[];
2423
private registeredTaskProviders: Disposable[];
2524

2625
constructor(context: vscode.ExtensionContext) {
@@ -39,20 +38,16 @@ export class ExtensionState {
3938
[],
4039
'**/.{adb,ads,adc,ada}'
4140
);
42-
this.clientsDisposables = [];
4341
this.registeredTaskProviders = [];
4442
}
4543

46-
public start = () => {
47-
this.clientsDisposables = [this.gprClient.start(), this.adaClient.start()];
44+
public start = async () => {
45+
await Promise.all([this.gprClient.start(), this.adaClient.start()]);
4846
this.registerTaskProviders();
4947
};
5048

5149
public dispose = () => {
5250
this.unregisterTaskProviders();
53-
this.clientsDisposables.forEach((clientDisposable: Disposable) =>
54-
clientDisposable.dispose()
55-
);
5651
};
5752

5853
public registerTaskProviders = (): void => {

integration/vscode/ada/src/alsClientFeatures.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import {
2323
ClientCapabilities,
2424
DocumentSelector,
25+
FeatureState,
2526
InitializeParams,
2627
ServerCapabilities,
2728
StaticFeature,
@@ -77,10 +78,26 @@ export class ALSClientFeatures implements StaticFeature {
7778
// eslint-disable-next-line @typescript-eslint/no-empty-function
7879
}
7980

81+
/**
82+
* Returns the state the feature is in.
83+
*/
84+
getState(): FeatureState {
85+
return { kind: 'static' };
86+
}
87+
8088
/**
8189
* Unused since there are no necessary actions when disposing an object of this class
8290
*/
8391
dispose(): void {
8492
// eslint-disable-next-line @typescript-eslint/no-empty-function
8593
}
94+
95+
/**
96+
* Called when the client is stopped or re-started to clear this feature.
97+
* Usually a feature un-registers listeners registered hooked up with the
98+
* VS Code extension host.
99+
*/
100+
clear(): void {
101+
// eslint-disable-next-line @typescript-eslint/no-empty-function
102+
}
86103
}

integration/vscode/ada/src/extension.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ async function activateExtension(context: vscode.ExtensionContext) {
148148
adaExtState.adaClient.clientOptions.middleware = alsMiddleware;
149149
adaExtState.adaClient.registerFeature(new ALSClientFeatures());
150150

151-
adaExtState.start();
151+
await adaExtState.start();
152152

153153
context.subscriptions.push(
154154
vscode.workspace.onDidChangeConfiguration(adaExtState.configChanged)
@@ -160,8 +160,6 @@ async function activateExtension(context: vscode.ExtensionContext) {
160160
*/
161161
registerCommands(context, adaExtState);
162162

163-
await Promise.all([adaExtState.adaClient.onReady(), adaExtState.gprClient.onReady()]);
164-
165163
await vscode.commands.executeCommand('setContext', ADA_CONTEXT, true);
166164

167165
await initializeTestView(context, adaExtState);

integration/vscode/ada/src/gnattest.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export async function initializeTestView(
6363
);
6464
context.subscriptions.push(controller);
6565

66-
await clients.adaClient.onReady();
6766
// Getting Paths Information from the server
6867
const projectFile = await getProjectFile(clients.adaClient);
6968
const objectDir: string = await getObjectDir(clients.adaClient);

integration/vscode/ada/src/taskProviders.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ class BuildAndRunExecution extends vscode.CustomExecution {
863863
},
864864
() => {
865865
writeEmitter.fire('Failed to get list of tasks\r\n');
866-
closeEmitter.fire(1);
866+
return 1;
867867
}
868868
)
869869
.then(

integration/vscode/ada/test/suite/general/extension.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ suite('Extensions Test Suite', function () {
1313
});
1414
test('Project File Response', async () => {
1515
if (vscode.workspace.workspaceFolders !== undefined) {
16-
await adaExtState.adaClient.onReady();
1716
const result: string = await getProjectFile(adaExtState.adaClient);
1817
const name = result.replace(/^.*[\\/]/, '');
1918
assert.strictEqual(name, 'default.gpr');
@@ -23,7 +22,6 @@ suite('Extensions Test Suite', function () {
2322
});
2423
test('Object Directory Response', async () => {
2524
if (vscode.workspace.workspaceFolders !== undefined) {
26-
await adaExtState.adaClient.onReady();
2725
const result: string = await getObjectDir(adaExtState.adaClient);
2826
const name = result?.replace(/^.*[\\/]/, '');
2927
assert.strictEqual(name, 'obj');
@@ -33,7 +31,6 @@ suite('Extensions Test Suite', function () {
3331
});
3432
test('Test Add Subprogram Box', async () => {
3533
if (vscode.workspace.workspaceFolders !== undefined) {
36-
await adaExtState.adaClient.onReady();
3734
const cursorPositions: vscode.Position[] = [
3835
new vscode.Position(9, 1),
3936
new vscode.Position(4, 1),

integration/vscode/ada/test/suite/general/syntax.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ suite('Syntax Check Test Suite', function () {
1515
false_statement: string,
1616
true_statement: string
1717
) {
18-
await adaExtState.adaClient.onReady();
1918
const syntaxProvider = new AdaSyntaxCheckProvider(adaExtState.adaClient, [rule]);
2019
let result = await syntaxProvider.sendCheckSyntaxRequest(true_statement);
2120
assert.deepStrictEqual(result, undefined);

integration/vscode/ada/test/suite/general/tasks.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ ada: Build and run main - src/test.adb - kind: buildAndRunMain`.trim();
5454
* Check that the list of offered SPARK tasks is expected.
5555
*/
5656
test('Spark tasks list', async () => {
57-
await adaExtState.adaClient.onReady();
5857
const prov = createSparkTaskProvider();
5958
const tasks = await prov.provideTasks();
6059
assert.notStrictEqual(tasks, undefined);

0 commit comments

Comments
 (0)