mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-10-07 10:38:30 +00:00

- Debounced the connectivity status update. - Silent the output channel for the Arduino LS. - Delay the problem markers update with 500ms. - Do not update the status bar on every `keypress` event. - Debounced the tab-bar toolbar updates when typing in editor. - Fixed electron menu contribution binding. - Aligned the editor widget factory's API to Theia. - Set the zoom level when the app is ready (Closes #1244) - Fixed event listener leak (Closes #1062) Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import { inject, injectable } from '@theia/core/shared/inversify';
|
||
import URI from '@theia/core/lib/common/uri';
|
||
import { EditorWidget } from '@theia/editor/lib/browser';
|
||
import type { NavigatableWidgetOptions } from '@theia/core/lib/browser';
|
||
import { EditorWidgetFactory as TheiaEditorWidgetFactory } from '@theia/editor/lib/browser/editor-widget-factory';
|
||
import {
|
||
CurrentSketch,
|
||
SketchesServiceClientImpl,
|
||
} from '../../../common/protocol/sketches-service-client-impl';
|
||
import { SketchesService, Sketch } from '../../../common/protocol';
|
||
import { nls } from '@theia/core/lib/common';
|
||
|
||
@injectable()
|
||
export class EditorWidgetFactory extends TheiaEditorWidgetFactory {
|
||
@inject(SketchesService)
|
||
private readonly sketchesService: SketchesService;
|
||
|
||
@inject(SketchesServiceClientImpl)
|
||
private readonly sketchesServiceClient: SketchesServiceClientImpl;
|
||
|
||
protected override async createEditor(
|
||
uri: URI,
|
||
options: NavigatableWidgetOptions
|
||
): Promise<EditorWidget> {
|
||
const widget = await super.createEditor(uri, options);
|
||
return this.maybeUpdateCaption(widget);
|
||
}
|
||
|
||
protected async maybeUpdateCaption(
|
||
widget: EditorWidget
|
||
): Promise<EditorWidget> {
|
||
const sketch = await this.sketchesServiceClient.currentSketch();
|
||
const { uri } = widget.editor;
|
||
if (CurrentSketch.isValid(sketch) && Sketch.isInSketch(uri, sketch)) {
|
||
const isTemp = await this.sketchesService.isTemp(sketch);
|
||
if (isTemp) {
|
||
widget.title.caption = nls.localize(
|
||
'theia/editor/unsavedTitle',
|
||
'Unsaved – {0}',
|
||
this.labelProvider.getName(uri)
|
||
);
|
||
}
|
||
}
|
||
return widget;
|
||
}
|
||
}
|