Skip to content

Commit b8fd059

Browse files
Restart language servers when env settings change
Instead of relaoding the whole VS Code window. Closes eng/ide/ada_language_server#1651
1 parent 61530d9 commit b8fd059

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

integration/vscode/ada/src/ExtensionState.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -311,22 +311,22 @@ export class ExtensionState {
311311
};
312312

313313
/**
314-
* Show a popup asking the user to reload the VS Code window after
315-
* changes made in the VS Code environment settings
316-
* (e.g: terminal.integrated.env.linux).
314+
* Show a popup asking the user to restart the Ada and GPR language
315+
* servers when some changes are made in the VS Code environment
316+
* settings (e.g: terminal.integrated.env.linux).
317317
*/
318-
public showReloadWindowPopup = async () => {
318+
public showRestartLanguageServersPopup = async () => {
319319
const selection = await vscode.window.showWarningMessage(
320-
`The workspace environment has changed: the VS Code window needs
321-
to be reloaded in order for the Ada Language Server to take the
320+
`The workspace environment has changed: the Ada Language Server instances
321+
need to be restarted in order to take the
322322
new environment into account.
323-
Do you want to reload the VS Code window?`,
324-
'Reload Window',
323+
Do you want to restart the Ada Language Server instances?`,
324+
'Restart Language Servers',
325325
);
326326

327-
// Reload the VS Code window if the user selected 'Yes'
328-
if (selection == 'Reload Window') {
329-
void vscode.commands.executeCommand('workbench.action.reloadWindow');
327+
// Restart the Ada and GPR language servers if the user asks for it
328+
if (selection == 'Restart Language Servers') {
329+
void vscode.commands.executeCommand(CMD_RESTART_LANG_SERVERS);
330330
}
331331
};
332332

@@ -346,13 +346,13 @@ export class ExtensionState {
346346

347347
// React to changes made in the environment variables, showing
348348
// a popup to reload the VS Code window and thus restart the
349-
// Ada extension.
349+
// Ada and GPR language servers.
350350
if (e.affectsConfiguration(TERMINAL_ENV_SETTING_NAME)) {
351351
const new_value = vscode.workspace.getConfiguration().get(TERMINAL_ENV_SETTING_NAME);
352352
logger.info(`${TERMINAL_ENV_SETTING_NAME} has changed: show reload popup`);
353353
logger.info(`${TERMINAL_ENV_SETTING_NAME}: ${JSON.stringify(new_value, undefined, 2)}`);
354354

355-
void this.showReloadWindowPopup();
355+
void this.showRestartLanguageServersPopup();
356356
}
357357
};
358358

0 commit comments

Comments
 (0)