8000 fix: use board+port at startup if it's restored by kittaakos · Pull Request #2242 · arduino/arduino-ide · GitHub
[go: up one dir, main page]

Skip to content

fix: use board+port at startup if it's restored #2242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: init Include Library if board+port is ready
Closes #2239

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta committed Sep 29, 2023
commit 20a192afe6d14818ad2be18ac8c53e9fb2c4d671
30 changes: 13 additions & 17 deletions arduino-ide-extension/src/browser/contributions/include-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import PQueue from 'p-queue';
import { inject, injectable } from '@theia/core/shared/inversify';
import URI from '@theia/core/lib/common/uri';
import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
import { EditorManager } from '@theia/editor/lib/browser';
import { MenuModelRegistry, MenuPath } from '@theia/core/lib/common/menu';
import {
Disposable,
Expand All @@ -22,28 +21,25 @@ import { CurrentSketch } from '../sketches-service-client-impl';
@injectable()
export class IncludeLibrary extends SketchContribution {
@inject(CommandRegistry)
protected readonly commandRegistry: CommandRegistry;
private readonly commandRegistry: CommandRegistry;

@inject(MenuModelRegistry)
protected readonly menuRegistry: MenuModelRegistry;
private readonly menuRegistry: MenuModelRegistry;

@inject(MainMenuManager)
protected readonly mainMenuManager: MainMenuManager;

@inject(EditorManager)
protected override readonly editorManager: EditorManager;
private readonly mainMenuManager: MainMenuManager;

@inject(NotificationCenter)
protected readonly notificationCenter: NotificationCenter;
private readonly notificationCenter: NotificationCenter;

@inject(BoardsServiceProvider)
protected readonly boardsServiceProvider: BoardsServiceProvider;
private readonly boardsServiceProvider: BoardsServiceProvider;

@inject(LibraryService)
protected readonly libraryService: LibraryService;
private readonly libraryService: LibraryService;

protected readonly queue = new PQueue({ autoStart: true, concurrency: 1 });
protected readonly toDispose = new DisposableCollection();
private readonly queue = new PQueue({ autoStart: true, concurrency: 1 });
private readonly toDispose = new DisposableCollection();

override onStart(): void {
this.boardsServiceProvider.onBoardsConfigDidChange(() =>
Expand All @@ -56,8 +52,8 @@ export class IncludeLibrary extends SketchContribution {
this.notificationCenter.onDidReinitialize(() => this.updateMenuActions());
}

override async onReady(): Promise<void> {
this.updateMenuActions();
override onReady(): void {
this.boardsServiceProvider.ready.then(() => this.updateMenuActions());
}

override registerMenus(registry: MenuModelRegistry): void {
Expand Down Expand Up @@ -93,7 +89,7 @@ export class IncludeLibrary extends SketchContribution {
});
}

protected async updateMenuActions(): Promise<void> {
private async updateMenuActions(): Promise<void> {
return this.queue.add(async () => {
this.toDispose.dispose();
this.mainMenuManager.update();
Expand Down Expand Up @@ -139,7 +135,7 @@ export class IncludeLibrary extends SketchContribution {
});
}

protected registerLibrary(
private registerLibrary(
libraryOrPlaceholder: LibraryPackage | string,
menuPath: MenuPath
): Disposable {
Expand Down Expand Up @@ -172,7 +168,7 @@ export class IncludeLibrary extends SketchContribution {
);
}

protected async includeLibrary(library: LibraryPackage): Promise<void> {
private async includeLibrary(library: LibraryPackage): Promise<void> {
const sketch = await this.sketchServiceClient.currentSketch();
if (!CurrentSketch.isValid(sketch)) {
return;
Expand Down
0