chore(deps): Updated to Theia 1.39.0 (#2144)

- update Theia to `1.39.0`,
 - remove the application packager and fix the security vulnerabilities,
 - bundle the backed application with `webpack`, and
 - enhance the developer docs.

Co-authored-by: Akos Kitta <a.kitta@arduino.cc>
Co-authored-by: per1234 <accounts@perglass.com>

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta
2023-08-14 12:12:05 +02:00
committed by GitHub
parent 144df893d0
commit 9a6a457bc4
143 changed files with 5011 additions and 8095 deletions

View File

@@ -1,11 +1,14 @@
import type { Disposable } from '@theia/core/lib/common/disposable';
import type { AppInfo } from '../electron-common/electron-arduino';
import type { StartupTasks } from '../electron-common/startup-task';
import type { Sketch } from './contributions/contribution';
export type { AppInfo };
export const AppService = Symbol('AppService');
export interface AppService {
quit(): void;
version(): Promise<string>;
info(): Promise<AppInfo>;
registerStartupTasksHandler(
handler: (tasks: StartupTasks) => void
): Disposable;

View File

@@ -30,7 +30,7 @@ import {
injectable,
postConstruct,
} from '@theia/core/shared/inversify';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { EditorCommands } from '@theia/editor/lib/browser/editor-command';
import { EditorMainMenu } from '@theia/editor/lib/browser/editor-menu';
import { MonacoMenus } from '@theia/monaco/lib/browser/monaco-menu';
@@ -69,7 +69,7 @@ export class ArduinoFrontendContribution
private readonly appStateService: FrontendApplicationStateService;
@postConstruct()
protected async init(): Promise<void> {
protected init(): void {
if (!window.navigator.onLine) {
// tslint:disable-next-line:max-line-length
this.messageService.warn(

View File

@@ -355,10 +355,8 @@ import { StylingParticipant } from '@theia/core/lib/browser/styling-service';
import { MonacoEditorMenuContribution } from './theia/monaco/monaco-menu';
import { MonacoEditorMenuContribution as TheiaMonacoEditorMenuContribution } from '@theia/monaco/lib/browser/monaco-menu';
import { UpdateArduinoState } from './contributions/update-arduino-state';
import { TerminalWidgetImpl } from './theia/terminal/terminal-widget-impl';
import { TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget';
import { TerminalFrontendContribution } from './theia/terminal/terminal-frontend-contribution';
import { TerminalFrontendContribution as TheiaTerminalFrontendContribution } from '@theia/terminal/lib/browser/terminal-frontend-contribution'
import { TerminalFrontendContribution as TheiaTerminalFrontendContribution } from '@theia/terminal/lib/browser/terminal-frontend-contribution';
// Hack to fix copy/cut/paste issue after electron version update in Theia.
// https://github.com/eclipse-theia/theia/issues/12487
@@ -1032,7 +1030,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
);
// Patch terminal issues.
rebind(TerminalWidget).to(TerminalWidgetImpl).inTransientScope();
bind(TerminalFrontendContribution).toSelf().inSingletonScope();
rebind(TheiaTerminalFrontendContribution).toService(TerminalFrontendContribution);
rebind(TheiaTerminalFrontendContribution).toService(
TerminalFrontendContribution
);
});

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { injectable, inject } from '@theia/core/shared/inversify';
import { Emitter } from '@theia/core/lib/common/event';
import { ReactWidget, Message } from '@theia/core/lib/browser';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { Event } from '@theia/core/lib/common/event';
import { notEmpty } from '@theia/core/lib/common/objects';
import { MaybePromise } from '@theia/core/lib/common/types';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import * as ReactDOM from '@theia/core/shared/react-dom';
import { CommandRegistry } from '@theia/core/lib/common/command';
import { DisposableCollection } from '@theia/core/lib/common/disposable';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
export type ProgressBarProps = {
percent?: number;

View File

@@ -4,7 +4,6 @@ import { nls } from '@theia/core/lib/common/nls';
import { isOSX, isWindows } from '@theia/core/lib/common/os';
import { inject, injectable } from '@theia/core/shared/inversify';
import moment from 'moment';
import { ConfigService } from '../../common/protocol';
import { AppService } from '../app-service';
import { ArduinoMenus } from '../menu/arduino-menus';
import {
@@ -18,8 +17,6 @@ import {
export class About extends Contribution {
@inject(ClipboardService)
private readonly clipboardService: ClipboardService;
@inject(ConfigService)
private readonly configService: ConfigService;
@inject(AppService)
private readonly appService: AppService;
@@ -42,11 +39,9 @@ export class About extends Contribution {
}
private async showAbout(): Promise<void> {
const [appVersion, cliVersion] = await Promise.all([
this.appService.version(),
this.configService.getVersion(),
]);
const buildDate = this.buildDate;
const appInfo = await this.appService.info();
const { appVersion, cliVersion, buildDate } = appInfo;
const detail = (showAll: boolean) =>
nls.localize(
'arduino/about/detail',
@@ -84,10 +79,6 @@ export class About extends Contribution {
return FrontendApplicationConfigProvider.get().applicationName;
}
private get buildDate(): string | undefined {
return FrontendApplicationConfigProvider.get().buildDate;
}
private ago(isoTime: string): string {
const now = moment(Date.now());
const other = moment(isoTime);

View File

@@ -1,5 +1,5 @@
import { nls } from '@theia/core/lib/common';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
export const CertificateAddComponent = ({
addCertificate,

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
export const CertificateListComponent = ({
certificates,

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import Tippy from '@tippyjs/react';
import { AvailableBoard } from '../../boards/boards-service-provider';
import { CertificateListComponent } from './certificate-list';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import {
inject,
injectable,

View File

@@ -1,5 +1,5 @@
import { nls } from '@theia/core/lib/common';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { AvailableBoard } from '../../boards/boards-service-provider';
import { ArduinoSelect } from '../../widgets/arduino-select';

View File

@@ -6,7 +6,7 @@ import { nls } from '@theia/core/lib/common/nls';
import { MaybePromise } from '@theia/core/lib/common/types';
import { Message } from '@theia/core/shared/@phosphor/messaging';
import { Widget } from '@theia/core/shared/@phosphor/widgets';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { CreateApi } from '../create/create-api';
import { AbstractDialog } from '../theia/dialogs/dialogs';

View File

@@ -1,5 +1,5 @@
import { nls } from '@theia/core/lib/common';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { Port } from '../../../common/protocol';
import {
ArduinoFirmwareUploader,

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import {
inject,
injectable,

View File

@@ -1,5 +1,5 @@
import { nls } from '@theia/core/lib/common/nls';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
// @ts-expect-error see https://github.com/microsoft/TypeScript/issues/49721#issuecomment-1319854183
import type { Options } from 'react-markdown';
import { ProgressInfo, UpdateInfo } from '../../../common/protocol/ide-updater';
@@ -111,7 +111,6 @@ export const IDEUpdaterComponent = ({
>
<ReactMarkdown
components={{
// @ts-expect-error see imports. There is no ESM type-only import in CommonJS modules.
a: ({ href, children, ...props }) => (
<a onClick={() => href && openExternal(href)} {...props}>
{children}

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import {
inject,
injectable,

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
import 'react-tabs/style/react-tabs.css';
import { Disable } from 'react-disable';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import {
injectable,
inject,

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import classnames from 'classnames';
interface SettingsStepInputProps {

View File

@@ -117,7 +117,7 @@ export class SettingsService {
protected _settings: Settings;
@postConstruct()
protected async init(): Promise<void> {
protected init(): void {
this.appStateService.reachedState('ready').then(async () => {
const settings = await this.loadSettings();
this._settings = deepClone(settings);

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { BoardUserField } from '../../../common/protocol';
import { nls } from '@theia/core/lib/common';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { inject, injectable } from '@theia/core/shared/inversify';
import { DialogProps } from '@theia/core/lib/browser/dialogs';
import { Message } from '@theia/core/shared/@phosphor/messaging';

View File

@@ -1,9 +1,13 @@
import * as React from '@theia/core/shared/react';
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
import React from '@theia/core/shared/react';
import {
injectable,
inject,
postConstruct,
} from '@theia/core/shared/inversify';
import {
AbstractViewContribution,
ApplicationShell,
codicon
codicon,
} from '@theia/core/lib/browser';
import { MonitorWidget } from './monitor-widget';
import { MenuModelRegistry, Command, CommandRegistry } from '@theia/core';
@@ -20,7 +24,7 @@ import { MonitorManagerProxyClient } from '../../../common/protocol';
import {
ArduinoPreferences,
defaultMonitorWidgetDockPanel,
isMonitorWidgetDockPanel
isMonitorWidgetDockPanel,
} from '../../arduino-preferences';
import { serialMonitorWidgetLabel } from '../../../common/nls';
@@ -60,7 +64,7 @@ export class MonitorViewContribution
static readonly TOGGLE_SERIAL_MONITOR_TOOLBAR =
MonitorWidget.ID + ':toggle-toolbar';
static readonly RESET_SERIAL_MONITOR = MonitorWidget.ID + ':reset';
@inject(MonitorModel)
private readonly model: MonitorModel;
@inject(MonitorManagerProxyClient)
@@ -85,10 +89,16 @@ export class MonitorViewContribution
@postConstruct()
protected init(): void {
this._panel = this.arduinoPreferences['arduino.monitor.dockPanel'] ?? defaultMonitorWidgetDockPanel;
this._panel =
this.arduinoPreferences['arduino.monitor.dockPanel'] ??
defaultMonitorWidgetDockPanel;
this.monitorManagerProxy.onMonitorShouldReset(() => this.reset());
this.arduinoPreferences.onPreferenceChanged((event) => {
if (event.preferenceName === 'arduino.monitor.dockPanel' && isMonitorWidgetDockPanel(event.newValue) && event.newValue !== this._panel) {
if (
event.preferenceName === 'arduino.monitor.dockPanel' &&
isMonitorWidgetDockPanel(event.newValue) &&
event.newValue !== this._panel
) {
this._panel = event.newValue;
const widget = this.tryGetWidget();
// reopen at the new position if opened
@@ -97,14 +107,14 @@ export class MonitorViewContribution
this.openView({ activate: true, reveal: true });
}
}
})
});
}
override get defaultViewOptions(): ApplicationShell.WidgetOptions {
const viewOptions = super.defaultViewOptions;
return {
...viewOptions,
area: this._panel
area: this._panel,
};
}

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import {
injectable,
inject,

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { Key, KeyCode } from '@theia/core/lib/browser/keys';
import { Board } from '../../../common/protocol/boards-service';
import { DisposableCollection, nls } from '@theia/core/lib/common';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { Event } from '@theia/core/lib/common/event';
import { DisposableCollection } from '@theia/core/lib/common/disposable';
import { areEqual, FixedSizeList as List } from 'react-window';

View File

@@ -1,7 +1,7 @@
import { AboutDialog as TheiaAboutDialog } from '@theia/core/lib/browser/about-dialog';
export class AboutDialog extends TheiaAboutDialog {
protected override async init(): Promise<void> {
protected override init(): void {
// NOOP
// IDE2 has a custom about dialog, so it does not make sense to collect Theia extensions at startup time.
}

View File

@@ -118,7 +118,7 @@ export class FrontendConnectionStatusService extends TheiaFrontendConnectionStat
private readonly connectionProvider: WebSocketConnectionProvider;
@postConstruct()
protected override async init(): Promise<void> {
protected override init(): void {
this.schedulePing();
const refresh = debounce(() => {
this.updateStatus(Boolean(this.daemonPort.port) && this.isOnline.online);

View File

@@ -7,7 +7,7 @@ import {
injectable,
postConstruct,
} from '@theia/core/shared/inversify';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { accountMenu } from '../../contributions/account';
import { CreateFeatures } from '../../create/create-features';
import { ApplicationConnectionStatusContribution } from './connection-status-service';

View File

@@ -1,9 +1,5 @@
import debounce from 'p-debounce';
import {
inject,
injectable,
postConstruct,
} from '@theia/core/shared/inversify';
import { inject, injectable } from '@theia/core/shared/inversify';
import URI from '@theia/core/lib/common/uri';
import { Event, Emitter } from '@theia/core/lib/common/event';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
@@ -42,9 +38,7 @@ export class DebugConfigurationManager extends TheiaDebugConfigurationManager {
return this.onTempContentDidChangeEmitter.event;
}
@postConstruct()
protected override async init(): Promise<void> {
super.init();
protected override async doInit(): Promise<void> {
this.appStateService.reachedState('ready').then(async () => {
const tempContent = await this.getTempLaunchJsonContent();
if (!tempContent) {
@@ -78,6 +72,7 @@ export class DebugConfigurationManager extends TheiaDebugConfigurationManager {
});
this.updateModels();
});
return super.doInit();
}
protected override updateModels = debounce(async () => {

View File

@@ -9,7 +9,7 @@ import {
DisposableCollection,
} from '@theia/core/lib/common/disposable';
import { inject, injectable } from '@theia/core/shared/inversify';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { createRoot } from '@theia/core/shared/react-dom/client';
@injectable()

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { NotificationComponent } from './notification-component';
import { NotificationCenterComponent as TheiaNotificationCenterComponent } from '@theia/messages/lib/browser/notification-center-component';
import { nls } from '@theia/core/lib/common';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { NotificationComponent as TheiaNotificationComponent } from '@theia/messages/lib/browser/notification-component';
import { nls } from '@theia/core/lib/common';
import { codicon } from '@theia/core/lib/browser';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { NotificationComponent } from './notification-component';
import { NotificationToastsComponent as TheiaNotificationToastsComponent } from '@theia/messages/lib/browser/notification-toasts-component';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import {
inject,
injectable,

View File

@@ -14,7 +14,7 @@ export class PreferenceTreeGenerator extends TheiaPreferenceTreeGenerator {
@inject(FrontendApplicationStateService)
private readonly appStateService: FrontendApplicationStateService;
protected override async init(): Promise<void> {
protected override init(): void {
this.appStateService.onStateChanged((state) => {
this.state = state;
// manually trigger a model (and UI) refresh if it was requested during the startup phase.

View File

@@ -1,38 +1,16 @@
import { TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
import { CommandRegistry } from '@theia/core/lib/common/command';
import { Widget } from '@theia/core/shared/@phosphor/widgets';
import { injectable } from '@theia/core/shared/inversify';
import { TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget';
import {
TerminalCommands,
TerminalFrontendContribution as TheiaTerminalFrontendContribution,
} from '@theia/terminal/lib/browser/terminal-frontend-contribution';
// Patch for https://github.com/eclipse-theia/theia/pull/12626
@injectable()
export class TerminalFrontendContribution extends TheiaTerminalFrontendContribution {
override registerCommands(commands: CommandRegistry): void {
super.registerCommands(commands);
commands.unregisterCommand(TerminalCommands.SPLIT);
commands.registerCommand(TerminalCommands.SPLIT, {
execute: () => this.splitTerminal(),
isEnabled: (w) => this.withWidget(w, () => true),
isVisible: (w) => this.withWidget(w, () => true),
});
}
override registerToolbarItems(toolbar: TabBarToolbarRegistry): void {
super.registerToolbarItems(toolbar);
// removes the `split-terminal` command from the tabbar toolbar
// https://github.com/dankeboy36/esp-exception-decoder/pull/1#pullrequestreview-1500146673
toolbar.unregisterItem(TerminalCommands.SPLIT.id);
}
private withWidget<T>(
widget: Widget | undefined,
fn: (widget: TerminalWidget) => T
): T | false {
if (widget instanceof TerminalWidget) {
return fn(widget);
}
return false;
}
}

View File

@@ -1,23 +0,0 @@
import { injectable } from '@theia/core/shared/inversify';
import { TerminalWidgetImpl as TheiaTerminalWidgetImpl } from '@theia/terminal/lib/browser/terminal-widget-impl';
import debounce from 'p-debounce';
// Patch for https://github.com/eclipse-theia/theia/pull/12587
@injectable()
export class TerminalWidgetImpl extends TheiaTerminalWidgetImpl {
private readonly debouncedResizeTerminal = debounce(
() => this.doResizeTerminal(),
50
);
protected override resizeTerminal(): void {
this.debouncedResizeTerminal();
}
private doResizeTerminal(): void {
const geo = this.fitAddon.proposeDimensions();
const cols = geo.cols;
const rows = geo.rows - 1; // subtract one row for margin
this.term.resize(cols, rows);
}
}

View File

@@ -28,6 +28,11 @@ export class WorkspaceInputDialog extends TheiaWorkspaceInputDialog {
protected override readonly labelProvider: LabelProvider
) {
super(props, labelProvider);
if (this.contentNode.contains(this.errorMessageNode)) {
// Reverts https://github.com/eclipse-theia/theia/pull/12585/files#diff-068570364d86f936ca72dfc52f8bfa93f14f6d971e2e6fa19216f33cb322244bR533-R534
this.contentNode.removeChild(this.errorMessageNode);
this.controlPanel.prepend(this.errorMessageNode);
}
this.node.classList.add('workspace-input-dialog');
this.appendCloseButton(Dialog.CANCEL);
}

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import {
TabBarToolbar,
TabBarToolbarRegistry,

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import type { Props, StylesConfig, ThemeConfig } from 'react-select';
import Select from 'react-select';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import type { Root } from '@theia/core/shared/react-dom/client';
import {
inject,

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { inject, injectable } from '@theia/core/shared/inversify';
import { TreeModel } from '@theia/core/lib/browser/tree/tree-model';
import { CloudSketchbookTreeModel } from './cloud-sketchbook-tree-model';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { DisposableCollection } from '@theia/core/lib/common/disposable';
import { CloudSketchbookTreeModel } from './cloud-sketchbook-tree-model';
import { AuthenticationClientService } from '../../auth/authentication-client-service';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import type { ArduinoComponent } from '../../../common/protocol/arduino-component';
import { Installable } from '../../../common/protocol/installable';
import type { ListItemRenderer } from './list-item-renderer';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { Virtuoso } from '@theia/core/shared/react-virtuoso';
import { ArduinoComponent } from '../../../common/protocol/arduino-component';
import { Installable } from '../../../common/protocol/installable';

View File

@@ -1,5 +1,5 @@
import { injectable } from '@theia/core/shared/inversify';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import {
BoardSearch,
LibrarySearch,

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import debounce from 'lodash.debounce';
import { Event } from '@theia/core/lib/common/event';
import { CommandService } from '@theia/core/lib/common/command';

View File

@@ -23,7 +23,7 @@ import {
import { MessageService } from '@theia/core/lib/common/message-service';
import { nls } from '@theia/core/lib/common/nls';
import { inject, injectable } from '@theia/core/shared/inversify';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { Unknown } from '../../../common/nls';
import {
CoreService,

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import {
injectable,
postConstruct,

View File

@@ -1,5 +1,5 @@
import { nls } from '@theia/core/lib/common';
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
export class SearchBar extends React.Component<SearchBar.Props> {
constructor(props: Readonly<SearchBar.Props>) {

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
export class CreateNew extends React.Component<CreateNew.Props> {
override render(): React.ReactNode {

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import { createRoot, Root } from '@theia/core/shared/react-dom/client';
import { inject, injectable } from '@theia/core/shared/inversify';
import { nls } from '@theia/core/lib/common/nls';

View File

@@ -1,4 +1,4 @@
import * as React from '@theia/core/shared/react';
import React from '@theia/core/shared/react';
import {
inject,
injectable,
@@ -62,12 +62,16 @@ export class SketchbookTreeWidget extends FileTreeWidget {
}
@postConstruct()
protected override async init(): Promise<void> {
protected override init(): void {
super.init();
// cache the current open sketch uri
const currentSketch = await this.sketchServiceClient.currentSketch();
this.currentSketchUri =
(CurrentSketch.isValid(currentSketch) && currentSketch.uri) || '';
this.sketchServiceClient
.currentSketch()
.then(
(currentSketch) =>
(this.currentSketchUri =
(CurrentSketch.isValid(currentSketch) && currentSketch.uri) || '')
);
}
protected override createNodeClassNames(