Skip to content

Commit 20a3193

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents d4101c1 + 12f379f commit 20a3193

File tree

7 files changed

+2105
-1081
lines changed

7 files changed

+2105
-1081
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,5 @@ subprojects/
105105

106106
# Temporary testsuite's files and directories
107107
testsuite/ada_lsp/project_symlinks/link
108+
109+
out

integration/vscode/ada/package-lock.json

+1,891-890
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/vscode/ada/package.json

+21-19
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.67.0"
9+
"vscode": "^1.71.2"
1010
},
1111
"categories": [
1212
"Programming Languages",
@@ -475,22 +475,22 @@
475475
]
476476
},
477477
"devDependencies": {
478-
"@types/glob": "7.2.0",
479-
"@types/mocha": "9.1.1",
480-
"@types/node": "14.17.6",
481-
"@types/vscode": "1.64.0",
482-
"@typescript-eslint/eslint-plugin": "5.21.0",
483-
"@typescript-eslint/parser": "5.21.0",
484-
"@vscode/test-electron": "2.1.3",
485-
"eslint": "8.14.0",
486-
"eslint-config-prettier": "8.5.0",
487-
"eslint-plugin-prettier": "4.0.0",
488-
"eslint-plugin-tsdoc": "0.2.16",
489-
"glob": "7.2.0",
490-
"mocha": "9.2.2",
491-
"prettier": "2.6.2",
492-
"typescript": "4.6.3",
493-
"vscode-tmgrammar-test": "0.0.11"
478+
"@types/mocha": "10.0.1",
479+
"@types/node": "18.15.3",
480+
"@types/vscode": "1.71.0",
481+
"@types/ws": "8.5.4",
482+
"@typescript-eslint/eslint-plugin": "5.54.0",
483+
"@typescript-eslint/parser": "5.55.0",
484+
"@vscode/test-electron": "2.3.0",
485+
"eslint": "8.36.0",
486+
"eslint-config-prettier": "8.7.0",
487+
"eslint-plugin-prettier": "4.2.1",
488+
"eslint-plugin-tsdoc": "0.2.17",
489+
"glob": "9.3.0",
490+
"mocha": "10.2.0",
491+
"prettier": "2.8.4",
492+
"typescript": "4.9.5",
493+
"vscode-tmgrammar-test": "0.1.1"
494494
},
495495
"scripts": {
496496
"vscode:prepublish": "npm run esbuild-base -- --minify",
@@ -502,9 +502,11 @@
502502
"test": "node ./out/test/runTest.js"
503503
},
504504
"dependencies": {
505-
"process": "0.11.10",
505+
"@types/command-exists": "1.2.0",
506+
"command-exists": "1.2.9",
506507
"fp-ts": "2.12.0",
508+
"process": "0.11.10",
507509
"vscode-languageclient": "7.0.0",
508-
"ws": "8.5.0"
510+
"ws": "8.13.0"
509511
}
510512
}

integration/vscode/ada/src/extension.ts

+61-66
Original file line numberDiff line numberDiff line change
@@ -139,29 +139,27 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
139139
// Create the language client
140140
return new LanguageClient(id, name, serverOptions, clientOptions);
141141
}
142+
142143
// Create the GPR language client and start it.
143144
const gprClient = createClient('gpr', 'GPR Language Server', ['--language-gpr'], '**/.{gpr}');
144145
context.subscriptions.push(gprClient.start());
146+
145147
// Create the Ada language client and start it.
146-
const client = createClient('ada', 'Ada Language Server', [], '**/.{adb,ads,adc,ada}');
148+
const alsClient = createClient('ada', 'Ada Language Server', [], '**/.{adb,ads,adc,ada}');
147149
const alsMiddleware: Middleware = {
148-
executeCommand: alsCommandExecutor(client),
150+
executeCommand: alsCommandExecutor(alsClient),
149151
};
150-
client.clientOptions.middleware = alsMiddleware;
151-
client.registerFeature(new ALSClientFeatures());
152-
153-
const disposable = client.start();
154-
// Push the disposable to the context's subscriptions so that the
155-
// client can be deactivated on extension deactivation
156-
context.subscriptions.push(disposable);
152+
alsClient.clientOptions.middleware = alsMiddleware;
153+
alsClient.registerFeature(new ALSClientFeatures());
154+
context.subscriptions.push(gprClient.start());
157155

158156
// Take active editor URI and call execute 'als-other-file' command in LSP
159157
function otherFileHandler() {
160158
const activeEditor = vscode.window.activeTextEditor;
161159
if (!activeEditor) {
162160
return;
163161
}
164-
void client.sendRequest(ExecuteCommandRequest.type, {
162+
void alsClient.sendRequest(ExecuteCommandRequest.type, {
165163
command: 'als-other-file',
166164
arguments: [
167165
{
@@ -205,69 +203,66 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
205203
// projects' source directories are not placed under the root project's directory).
206204
// Do nothing is the user did not setup any workspace file.
207205
if (vscode.workspace.workspaceFile !== undefined) {
208-
await client.onReady().then(async () => {
209-
await client
210-
.sendRequest<[ALSSourceDirDescription]>('workspace/alsSourceDirs')
211-
.then(async (source_dirs) => {
212-
const workspace_folders = vscode.workspace.workspaceFolders ?? [];
213-
const workspace_dirs_to_add: { uri: vscode.Uri; name?: string | undefined }[] =
214-
[];
206+
await alsClient
207+
.sendRequest<[ALSSourceDirDescription]>('workspace/alsSourceDirs')
208+
.then(async (source_dirs) => {
209+
const workspace_folders = vscode.workspace.workspaceFolders ?? [];
210+
const workspace_dirs_to_add: { uri: vscode.Uri; name?: string | undefined }[] = [];
215211

216-
for (const source_dir of source_dirs) {
217-
const source_dir_uri = vscode.Uri.parse(source_dir.uri);
218-
const source_dir_path = source_dir_uri.path;
212+
for (const source_dir of source_dirs) {
213+
const source_dir_uri = vscode.Uri.parse(source_dir.uri);
214+
const source_dir_path = source_dir_uri.path;
219215

220-
const is_subdirectory = (dir: string, parent: string) => {
221-
// Use lower-case on Windows since drives can be specified in VS Code
222-
// either with lower or upper case characters.
223-
if (process.platform == 'win32') {
224-
dir = dir.toLowerCase();
225-
parent = parent.toLowerCase();
226-
}
216+
const is_subdirectory = (dir: string, parent: string) => {
217+
// Use lower-case on Windows since drives can be specified in VS Code
218+
// either with lower or upper case characters.
219+
if (process.platform == 'win32') {
220+
dir = dir.toLowerCase();
221+
parent = parent.toLowerCase();
222+
}
227223

228-
return dir.startsWith(parent + '/');
229-
};
224+
return dir.startsWith(parent + '/');
225+
};
230226

231-
// If the source directory is not under one of the workspace folders, push
232-
// this source directory to the workspace folders to add later.
233-
if (
234-
!workspace_folders.some((workspace_folder) =>
235-
is_subdirectory(source_dir_path, workspace_folder.uri.path)
236-
)
237-
) {
238-
workspace_dirs_to_add.push({
239-
name: source_dir.name,
240-
uri: source_dir_uri,
241-
});
242-
}
227+
// If the source directory is not under one of the workspace folders, push
228+
// this source directory to the workspace folders to add later.
229+
if (
230+
!workspace_folders.some((workspace_folder) =>
231+
is_subdirectory(source_dir_path, workspace_folder.uri.path)
232+
)
233+
) {
234+
workspace_dirs_to_add.push({
235+
name: source_dir.name,
236+
uri: source_dir_uri,
237+
});
243238
}
239+
}
244240

245-
// If there are some source directories missing in the workspace, ask the user
246-
// to add them in his workspace.
247-
if (workspace_dirs_to_add.length > 0) {
248-
await vscode.window
249-
.showInformationMessage(
250-
'Some project source directories are not ' +
251-
'listed in your workspace: do you want to add them?',
252-
'Yes',
253-
'No'
254-
)
255-
.then((answer) => {
256-
if (answer === 'Yes') {
257-
for (const workspace_dir of workspace_dirs_to_add) {
258-
vscode.workspace.updateWorkspaceFolders(
259-
vscode.workspace.workspaceFolders
260-
? vscode.workspace.workspaceFolders.length
261-
: 0,
262-
null,
263-
workspace_dir
264-
);
265-
}
241+
// If there are some source directories missing in the workspace, ask the user
242+
// to add them in his workspace.
243+
if (workspace_dirs_to_add.length > 0) {
244+
await vscode.window
245+
.showInformationMessage(
246+
'Some project source directories are not ' +
247+
'listed in your workspace: do you want to add them?',
248+
'Yes',
249+
'No'
250+
)
251+
.then((answer) => {
252+
if (answer === 'Yes') {
253+
for (const workspace_dir of workspace_dirs_to_add) {
254+
vscode.workspace.updateWorkspaceFolders(
255+
vscode.workspace.workspaceFolders
256+
? vscode.workspace.workspaceFolders.length
257+
: 0,
258+
null,
259+
workspace_dir
260+
);
266261
}
267-
});
268-
}
269-
});
270-
});
262+
}
263+
});
264+
}
265+
});
271266
}
272267
}
273268

0 commit comments

Comments
 (0)