Skip to content

Commit 0b361d4

Browse files
author
Akos Kitta
committed
Aligned the editor widget factory API with Theia.
To correctly use and parse the widget `id`. Ref: eclipse-theia/theia@86a4fc6#r79349262 Signed-off-by: Akos Kitta <[email protected]>
1 parent e9b471c commit 0b361d4

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
import { injectable } from '@theia/core/shared/inversify';
2-
import { EditorWidget } from '@theia/editor/lib/browser';
3-
import {
4-
EditorManager as TheiaEditorManager,
5-
WidgetId,
6-
} from '@theia/editor/lib/browser/editor-manager';
2+
import { EditorManager as TheiaEditorManager } from '@theia/editor/lib/browser/editor-manager';
73

84
@injectable()
95
export class EditorManager extends TheiaEditorManager {
106
protected override getOrCreateCounterForUri(): number {
117
return 0;
128
}
13-
14-
protected override extractIdFromWidget(widget: EditorWidget): WidgetId {
15-
const { id, uri } = super.extractIdFromWidget(widget);
16-
// https://github.com/eclipse-theia/theia/commit/86a4fc66c112310fb39f50024ea4a2607ed5927e#r79349262
17-
if (Number.isNaN(id)) {
18-
return { uri, id: 0 };
19-
}
20-
return { id, uri };
21-
}
229
}

Diff for: arduino-ide-extension/src/browser/theia/editor/editor-widget-factory.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { inject, injectable } from '@theia/core/shared/inversify';
22
import URI from '@theia/core/lib/common/uri';
33
import { EditorWidget } from '@theia/editor/lib/browser';
4-
import { LabelProvider } from '@theia/core/lib/browser';
4+
import {
5+
LabelProvider,
6+
NavigatableWidgetOptions,
7+
} from '@theia/core/lib/browser';
58
import { EditorWidgetFactory as TheiaEditorWidgetFactory } from '@theia/editor/lib/browser/editor-widget-factory';
69
import {
710
CurrentSketch,
@@ -21,8 +24,11 @@ export class EditorWidgetFactory extends TheiaEditorWidgetFactory {
2124
@inject(LabelProvider)
2225
protected override readonly labelProvider: LabelProvider;
2326

24-
protected override async createEditor(uri: URI): Promise<EditorWidget> {
25-
const widget = await super.createEditor(uri);
27+
protected override async createEditor(
28+
uri: URI,
29+
options?: NavigatableWidgetOptions
30+
): Promise<EditorWidget> {
31+
const widget = await super.createEditor(uri, options);
2632
return this.maybeUpdateCaption(widget);
2733
}
2834

0 commit comments

Comments
 (0)