Skip to content

Commit aeeac57

Browse files
author
Akos Kitta
committed
Do not update status bar on every keyDown event.
Signed-off-by: Akos Kitta <[email protected]>
1 parent 575eeec commit aeeac57

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Diff for: arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts

+6
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ import { SelectedBoard } from './contributions/selected-board';
310310
import { CheckForUpdates } from './contributions/check-for-updates';
311311
import { OpenBoardsConfig } from './contributions/open-boards-config';
312312
import { SketchFilesTracker } from './contributions/sketch-files-tracker';
313+
import { StatusBarImpl } from './theia/core/status-bar';
314+
import { StatusBarImpl as TheiaStatusBarImpl } from '@theia/core/lib/browser';
313315

314316
MonacoThemingService.register({
315317
id: 'arduino-theme',
@@ -805,6 +807,10 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
805807
bind(WidgetManager).toSelf().inSingletonScope();
806808
rebind(TheiaWidgetManager).toService(WidgetManager);
807809

810+
// To avoid running a status bar update on every single `keyDown` event from the editor.
811+
bind(StatusBarImpl).toSelf().inSingletonScope();
812+
rebind(TheiaStatusBarImpl).toService(StatusBarImpl);
813+
808814
// Preferences
809815
bindArduinoPreferences(bind);
810816

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { injectable } from '@theia/core/shared/inversify';
2+
import { StatusBarImpl as TheiaStatusBarImpl } from '@theia/core/lib/browser';
3+
4+
@injectable()
5+
export class StatusBarImpl extends TheiaStatusBarImpl {
6+
override async removeElement(id: string): Promise<void> {
7+
await this.ready;
8+
if (this.entries.delete(id)) {
9+
// Unlike Theia, IDE2 updates the status if the element to remove was among the entries. Otherwise, it's a NOOP.
10+
this.update();
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)