Skip to content

Commit a390951

Browse files
Merge branch 'topic/als#1311' into 'master'
Add logging for didChangeConfiguration event See merge request eng/ide/ada_language_server!1517
2 parents 92f0f3d + 4c1c674 commit a390951

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

integration/vscode/ada/src/ExtensionState.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { initializeTesting } from './gnattest';
88
import { GprTaskProvider } from './gprTaskProvider';
99
import { TERMINAL_ENV_SETTING_NAME } from './helpers';
1010
import { registerTaskProviders } from './taskProviders';
11+
import { logger } from './extension';
1112

1213
/**
1314
* This class encapsulates all state that should be maintained throughout the
@@ -125,10 +126,13 @@ export class ExtensionState {
125126
// React to changes in configuration to recompute predefined tasks if the user
126127
// changes scenario variables' values.
127128
public configChanged = (e: vscode.ConfigurationChangeEvent) => {
129+
logger.info('didChangeConfiguration event received');
130+
128131
if (
129132
e.affectsConfiguration('ada.scenarioVariables') ||
130133
e.affectsConfiguration('ada.projectFile')
131134
) {
135+
logger.info('project related settings have changed: clearing caches for tasks');
132136
this.clearALSCache();
133137
this.unregisterTaskProviders();
134138
this.registerTaskProviders();
@@ -138,6 +142,10 @@ export class ExtensionState {
138142
// a popup to reload the VS Code window and thus restart the
139143
// Ada extension.
140144
if (e.affectsConfiguration(TERMINAL_ENV_SETTING_NAME)) {
145+
const new_value = vscode.workspace.getConfiguration().get(TERMINAL_ENV_SETTING_NAME);
146+
logger.info(`${TERMINAL_ENV_SETTING_NAME} has changed: show reload popup`);
147+
logger.info(`${TERMINAL_ENV_SETTING_NAME}: ${JSON.stringify(new_value, undefined, 2)}`);
148+
141149
void this.showReloadWindowPopup();
142150
}
143151
};

integration/vscode/ada/src/extension.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ async function activateExtension(context: vscode.ExtensionContext) {
140140
adaExtState = new ExtensionState(context);
141141
context.subscriptions.push(adaExtState);
142142

143+
// Subscribe to the didChangeConfiguration event
144+
context.subscriptions.push(
145+
vscode.workspace.onDidChangeConfiguration(adaExtState.configChanged)
146+
);
147+
143148
const alsMiddleware: Middleware = {
144149
executeCommand: alsCommandExecutor(adaExtState.adaClient),
145150
};
@@ -148,10 +153,6 @@ async function activateExtension(context: vscode.ExtensionContext) {
148153

149154
await adaExtState.start();
150155

151-
context.subscriptions.push(
152-
vscode.workspace.onDidChangeConfiguration(adaExtState.configChanged)
153-
);
154-
155156
/**
156157
* Register commands first so that commands such as displaying the extension
157158
* Output become available even if the language servers fail to start.

0 commit comments

Comments
 (0)