message: refactor: only update statusbar color if color has changed
diff: @@ -4,16 +4,13 @@ import { configuration } from './configuration/configuration';
  class StatusBarImpl implements vscode.Disposable {
  private _statusBarItem: vscode.StatusBarItem;
  - private _previousModeName: ModeName | undefined;
  - private _wasRecordingMacro: boolean;
  - private _wasHighPriority: boolean;
  + private _previousModeName: ModeName | undefined = undefined;
  + private _wasRecordingMacro = false;
  + private _wasHighPriority = false;
  constructor() {
  this._statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
  this._statusBarItem.show();
  - this._previousModeName = undefined;
  - this._wasRecordingMacro = false;
  - this._wasHighPriority = false;
  }
  public Set(
  @@ -22,22 +19,24 @@ class StatusBarImpl implements vscode.Disposable {
  isRecordingMacro: boolean,
  isHighPriority: boolean = false
  ) {
  - let hasModeChanged = mode !== this._previousModeName;
  + const hasModeChanged = mode !== this._previousModeName;
  // text
  - let shouldUpdateText =
  + const shouldUpdateText =
  hasModeChanged ||
  mode === ModeName.SearchInProgressMode ||
  mode === ModeName.CommandlineInProgress ||
  isRecordingMacro !== this._wasRecordingMacro ||
  configuration.showcmd;
  + // errors and other high-priorty messages remain displayed on the status bar
  + // until specific conditions are met (such as the mode has changed)
  if ((shouldUpdateText && !this._wasHighPriority) || isHighPriority) {
  this.UpdateText(text);
  }
  // color
  - let shouldUpdateColor = configuration.statusBarColorControl && hasModeChanged;
  + const shouldUpdateColor = configuration.statusBarColorControl && hasModeChanged;
  if (shouldUpdateColor) {
  this.UpdateColor(mode);
  }
  @@ -73,9 +72,8 @@ class StatusBarImpl implements vscode.Disposable {
  }
  }
  - const currentColorCustomizations = vscode.workspace
  - .getConfiguration('workbench')
  - .get('colorCustomizations');
  + const workbenchConfiguration = vscode.workspace.getConfiguration('workbench');
  + const currentColorCustomizations = workbenchConfiguration.get('colorCustomizations');
  const colorCustomizations = Object.assign(currentColorCustomizations || {}, {
  'statusBar.background': `${background}`,
  @@ -88,9 +86,9 @@ class StatusBarImpl implements vscode.Disposable {
  delete colorCustomizations['statusBar.foreground'];
  }
  - vscode.workspace
  - .getConfiguration('workbench')
  - .update('colorCustomizations', colorCustomizations, true);
  + if (currentColorCustomizations !== colorCustomizations) {
  + workbenchConfiguration.update('colorCustomizations', colorCustomizations, true);
  + }
  }
  }
  