Fix issues with dynamic updating of the version status bar item

1. Wait a few seconds before updating the status bar after a version
   change.
2. Ensure we are watching the correct configuration items for changes.
3. Ensure the cli version is refreshed correctly.
This commit is contained in:
Andrew Eisenberg
2021-02-11 15:02:46 -08:00
parent 6304fe0e30
commit 707cba4ac9
4 changed files with 12 additions and 4 deletions

View File

@@ -5,6 +5,7 @@
- Avoid displaying an error when removing orphaned databases and the storage folder does not exist. [#748](https://github.com/github/vscode-codeql/pull/748)
- Add better error messages when AST Viewer is unable to create an AST. [#753](https://github.com/github/vscode-codeql/pull/753)
- Cache AST viewing operations so that subsequent calls to view the AST of a single file will be extremely fast. [#753](https://github.com/github/vscode-codeql/pull/753)
- Ensure CodeQL version in status bar updates correctly when version changes. [#754](https://github.com/github/vscode-codeql/pull/754)
## 1.4.2 - 2 February 2021

View File

@@ -162,6 +162,7 @@ export class CodeQLCliServer implements Disposable {
if (this.distributionProvider.onDidChangeDistribution) {
this.distributionProvider.onDidChangeDistribution(() => {
this.restartCliServer();
this._version = undefined;
});
}
if (this.cliConfig.onDidChangeConfiguration) {

View File

@@ -50,7 +50,7 @@ export const GLOBAL_ENABLE_TELEMETRY = new Setting('enableTelemetry', GLOBAL_TEL
// Distribution configuration
const DISTRIBUTION_SETTING = new Setting('cli', ROOT_SETTING);
const CUSTOM_CODEQL_PATH_SETTING = new Setting('executablePath', DISTRIBUTION_SETTING);
export const CUSTOM_CODEQL_PATH_SETTING = new Setting('executablePath', DISTRIBUTION_SETTING);
const INCLUDE_PRERELEASE_SETTING = new Setting('includePrerelease', DISTRIBUTION_SETTING);
const PERSONAL_ACCESS_TOKEN_SETTING = new Setting('personalAccessToken', DISTRIBUTION_SETTING);
const QUERY_HISTORY_SETTING = new Setting('queryHistory', ROOT_SETTING);

View File

@@ -1,6 +1,6 @@
import { ConfigurationChangeEvent, StatusBarAlignment, StatusBarItem, window, workspace } from 'vscode';
import { CodeQLCliServer } from './cli';
import { CANARY_FEATURES, DistributionConfigListener } from './config';
import { CANARY_FEATURES, CUSTOM_CODEQL_PATH_SETTING, DistributionConfigListener } from './config';
import { DisposableObject } from './pure/disposable-object';
/**
@@ -24,8 +24,14 @@ export class CodeQlStatusBarHandler extends DisposableObject {
}
private handleDidChangeConfiguration(e: ConfigurationChangeEvent) {
if (e.affectsConfiguration(CANARY_FEATURES.qualifiedName)) {
this.updateStatusItem();
if (
e.affectsConfiguration(CANARY_FEATURES.qualifiedName) ||
e.affectsConfiguration(CUSTOM_CODEQL_PATH_SETTING.qualifiedName)
) {
// Wait a few seconds before updating the status item.
// This avoids a race condition where the cli's version
// is not updated before the status bar is refreshed.
setTimeout(() => this.updateStatusItem(), 3000);
}
}