Skip to content

Commit cab510f

Browse files
committed
Introduce forceUpdateConfiguration method
1 parent 54be065 commit cab510f

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

extensions/ql-vscode/src/config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ export interface DistributionConfig {
119119
ownerName?: string;
120120
repositoryName?: string;
121121
onDidChangeConfiguration?: Event<void>;
122+
123+
/**
124+
* This forces an update of the distribution, even if the settings haven't changed.
125+
*
126+
* This should only be used when the distribution has been updated outside of the extension
127+
* and only in tests. It should not be called in production code.
128+
*/
129+
forceUpdateConfiguration(): void;
122130
}
123131

124132
// Query server configuration
@@ -275,6 +283,10 @@ export class DistributionConfigListener
275283
);
276284
}
277285

286+
public forceUpdateConfiguration() {
287+
this._onDidChangeConfiguration.fire(undefined);
288+
}
289+
278290
protected handleDidChangeConfiguration(e: ConfigurationChangeEvent): void {
279291
this.handleDidChangeConfigurationForRelevantSettings(
280292
DISTRIBUTION_CHANGE_SETTINGS,

extensions/ql-vscode/test/vscode-tests/cli-integration/jest.setup.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,11 @@ beforeAll(async () => {
3939
const cliVersion = await extension.cliServer.getVersion();
4040

4141
if (cliVersion.compare(process.env.CLI_VERSION) !== 0) {
42-
// This calls the private `updateConfiguration` method in the `ConfigListener`
4342
// It seems like the CUSTOM_CODEQL_PATH_SETTING.updateValue() call in
4443
// `beforeAllAction` doesn't fire the event that the config has changed.
44+
// `forceUpdateConfiguration` will fire the event manually.
4545
// This is a hacky workaround.
46-
(
47-
extension.distributionManager.config as unknown as {
48-
updateConfiguration: () => void;
49-
}
50-
).updateConfiguration();
46+
extension.distributionManager.config.forceUpdateConfiguration();
5147
}
5248
}
5349
});

0 commit comments

Comments
 (0)