Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a36524e

Browse filesBrowse files
Akos Kittakittaakos
authored andcommitted
Update package index on 3rd party URLs change.
Closes #637 Closes #906 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 1073c3f commit a36524e
Copy full SHA for a36524e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

43 files changed

+1043
-695
lines changed

‎arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ import { MonacoTextModelService } from './theia/monaco/monaco-text-model-service
163163
import { ResponseServiceImpl } from './response-service-impl';
164164
import {
165165
ResponseService,
166-
ResponseServiceArduino,
166+
ResponseServiceClient,
167167
ResponseServicePath,
168168
} from '../common/protocol/response-service';
169169
import { NotificationCenter } from './notification-center';
@@ -302,6 +302,8 @@ import { CompilerErrors } from './contributions/compiler-errors';
302302
import { WidgetManager } from './theia/core/widget-manager';
303303
import { WidgetManager as TheiaWidgetManager } from '@theia/core/lib/browser/widget-manager';
304304
import { StartupTask } from './widgets/sketchbook/startup-task';
305+
import { IndexesUpdateProgress } from './contributions/indexes-update-progress';
306+
import { Daemon } from './contributions/daemon';
305307

306308
MonacoThemingService.register({
307309
id: 'arduino-theme',
@@ -695,6 +697,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
695697
Contribution.configure(bind, Format);
696698
Contribution.configure(bind, CompilerErrors);
697699
Contribution.configure(bind, StartupTask);
700+
Contribution.configure(bind, IndexesUpdateProgress);
701+
Contribution.configure(bind, Daemon);
698702

699703
// Disabled the quick-pick customization from Theia when multiple formatters are available.
700704
// Use the default VS Code behavior, and pick the first one. In the IDE2, clang-format has `exclusive` selectors.
@@ -716,7 +720,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
716720
});
717721

718722
bind(ResponseService).toService(ResponseServiceImpl);
719-
bind(ResponseServiceArduino).toService(ResponseServiceImpl);
723+
bind(ResponseServiceClient).toService(ResponseServiceImpl);
720724

721725
bind(NotificationCenter).toSelf().inSingletonScope();
722726
bind(FrontendApplicationContribution).toService(NotificationCenter);

‎arduino-ide-extension/src/browser/boards/boards-auto-installer.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/boards/boards-auto-installer.ts
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Port,
99
} from '../../common/protocol/boards-service';
1010
import { BoardsServiceProvider } from './boards-service-provider';
11-
import { Installable, ResponseServiceArduino } from '../../common/protocol';
11+
import { Installable, ResponseServiceClient } from '../../common/protocol';
1212
import { BoardsListWidgetFrontendContribution } from './boards-widget-frontend-contribution';
1313
import { nls } from '@theia/core/lib/common';
1414
import { NotificationCenter } from '../notification-center';
@@ -45,8 +45,8 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution {
4545
@inject(BoardsServiceProvider)
4646
protected readonly boardsServiceClient: BoardsServiceProvider;
4747

48-
@inject(ResponseServiceArduino)
49-
protected readonly responseService: ResponseServiceArduino;
48+
@inject(ResponseServiceClient)
49+
protected readonly responseService: ResponseServiceClient;
5050

5151
@inject(BoardsListWidgetFrontendContribution)
5252
protected readonly boardsManagerFrontendContribution: BoardsListWidgetFrontendContribution;
@@ -86,7 +86,7 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution {
8686
// installed, though this is not strictly necessary. It's more of a
8787
// cleanup, to ensure the related variables are representative of
8888
// current state.
89-
this.notificationCenter.onPlatformInstalled((installed) => {
89+
this.notificationCenter.onPlatformDidInstall((installed) => {
9090
if (this.lastRefusedPackageId === installed.item.id) {
9191
this.clearLastRefusedPromptInfo();
9292
}

‎arduino-ide-extension/src/browser/boards/boards-config.tsx

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/boards/boards-config.tsx
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class BoardsConfig extends React.Component<
113113
);
114114
}
115115
}),
116-
this.props.notificationCenter.onAttachedBoardsChanged((event) =>
116+
this.props.notificationCenter.onAttachedBoardsDidChange((event) =>
117117
this.updatePorts(
118118
event.newState.ports,
119119
AttachedBoardsChangeEvent.diff(event).detached.ports
@@ -126,19 +126,19 @@ export class BoardsConfig extends React.Component<
126126
);
127127
}
128128
),
129-
this.props.notificationCenter.onPlatformInstalled(() =>
129+
this.props.notificationCenter.onPlatformDidInstall(() =>
130130
this.updateBoards(this.state.query)
131131
),
132-
this.props.notificationCenter.onPlatformUninstalled(() =>
132+
this.props.notificationCenter.onPlatformDidUninstall(() =>
133133
this.updateBoards(this.state.query)
134134
),
135-
this.props.notificationCenter.onIndexUpdated(() =>
135+
this.props.notificationCenter.onIndexDidUpdate(() =>
136136
this.updateBoards(this.state.query)
137137
),
138-
this.props.notificationCenter.onDaemonStarted(() =>
138+
this.props.notificationCenter.onDaemonDidStart(() =>
139139
this.updateBoards(this.state.query)
140140
),
141-
this.props.notificationCenter.onDaemonStopped(() =>
141+
this.props.notificationCenter.onDaemonDidStop(() =>
142142
this.setState({ searchResults: [] })
143143
),
144144
this.props.onFilteredTextDidChangeEvent((query) =>

‎arduino-ide-extension/src/browser/boards/boards-data-store.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/boards/boards-data-store.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class BoardsDataStore implements FrontendApplicationContribution {
3333
protected readonly onChangedEmitter = new Emitter<void>();
3434

3535
onStart(): void {
36-
this.notificationCenter.onPlatformInstalled(async ({ item }) => {
36+
this.notificationCenter.onPlatformDidInstall(async ({ item }) => {
3737
let shouldFireChanged = false;
3838
for (const fqbn of item.boards
3939
.map(({ fqbn }) => fqbn)

‎arduino-ide-extension/src/browser/boards/boards-list-widget.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/boards/boards-list-widget.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export class BoardsListWidget extends ListWidget<BoardsPackage> {
3333
protected override init(): void {
3434
super.init();
3535
this.toDispose.pushAll([
36-
this.notificationCenter.onPlatformInstalled(() =>
36+
this.notificationCenter.onPlatformDidInstall(() =>
3737
this.refresh(undefined)
3838
),
39-
this.notificationCenter.onPlatformUninstalled(() =>
39+
this.notificationCenter.onPlatformDidUninstall(() =>
4040
this.refresh(undefined)
4141
),
4242
]);

‎arduino-ide-extension/src/browser/boards/boards-service-provider.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/boards/boards-service-provider.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
7777
private readonly _reconciled = new Deferred<void>();
7878

7979
onStart(): void {
80-
this.notificationCenter.onAttachedBoardsChanged(
80+
this.notificationCenter.onAttachedBoardsDidChange(
8181
this.notifyAttachedBoardsChanged.bind(this)
8282
);
83-
this.notificationCenter.onPlatformInstalled(
83+
this.notificationCenter.onPlatformDidInstall(
8484
this.notifyPlatformInstalled.bind(this)
8585
);
86-
this.notificationCenter.onPlatformUninstalled(
86+
this.notificationCenter.onPlatformDidUninstall(
8787
this.notifyPlatformUninstalled.bind(this)
8888
);
8989

‎arduino-ide-extension/src/browser/contributions/add-zip-library.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/contributions/add-zip-library.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ArduinoMenus } from '../menu/arduino-menus';
77
import {
88
Installable,
99
LibraryService,
10-
ResponseServiceArduino,
10+
ResponseServiceClient,
1111
} from '../../common/protocol';
1212
import {
1313
SketchContribution,
@@ -22,8 +22,8 @@ export class AddZipLibrary extends SketchContribution {
2222
@inject(EnvVariablesServer)
2323
protected readonly envVariableServer: EnvVariablesServer;
2424

25-
@inject(ResponseServiceArduino)
26-
protected readonly responseService: ResponseServiceArduino;
25+
@inject(ResponseServiceClient)
26+
protected readonly responseService: ResponseServiceClient;
2727

2828
@inject(LibraryService)
2929
protected readonly libraryService: LibraryService;

‎arduino-ide-extension/src/browser/contributions/board-selection.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/contributions/board-selection.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ PID: ${PID}`;
101101
}
102102

103103
override onStart(): void {
104-
this.notificationCenter.onPlatformInstalled(() => this.updateMenus());
105-
this.notificationCenter.onPlatformUninstalled(() => this.updateMenus());
104+
this.notificationCenter.onPlatformDidInstall(() => this.updateMenus());
105+
this.notificationCenter.onPlatformDidUninstall(() => this.updateMenus());
106106
this.boardsServiceProvider.onBoardsConfigChanged(() => this.updateMenus());
107107
this.boardsServiceProvider.onAvailableBoardsChanged(() =>
108108
this.updateMenus()
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { nls } from '@theia/core';
2+
import { inject, injectable } from '@theia/core/shared/inversify';
3+
import { ArduinoDaemon } from '../../common/protocol';
4+
import { Contribution, Command, CommandRegistry } from './contribution';
5+
6+
@injectable()
7+
export class Daemon extends Contribution {
8+
@inject(ArduinoDaemon)
9+
private readonly daemon: ArduinoDaemon;
10+
11+
override registerCommands(registry: CommandRegistry): void {
12+
registry.registerCommand(Daemon.Commands.START_DAEMON, {
13+
execute: () => this.daemon.start(),
14+
});
15+
registry.registerCommand(Daemon.Commands.STOP_DAEMON, {
16+
execute: () => this.daemon.stop(),
17+
});
18+
registry.registerCommand(Daemon.Commands.RESTART_DAEMON, {
19+
execute: () => this.daemon.restart(),
20+
});
21+
}
22+
}
23+
export namespace Daemon {
24+
export namespace Commands {
25+
export const START_DAEMON: Command = {
26+
id: 'arduino-start-daemon',
27+
label: nls.localize('arduino/daemon/start', 'Start Daemon'),
28+
category: 'Arduino',
29+
};
30+
export const STOP_DAEMON: Command = {
31+
id: 'arduino-stop-daemon',
32+
label: nls.localize('arduino/daemon/stop', 'Stop Daemon'),
33+
category: 'Arduino',
34+
};
35+
export const RESTART_DAEMON: Command = {
36+
id: 'arduino-restart-daemon',
37+
label: nls.localize('arduino/daemon/restart', 'Restart Daemon'),
38+
category: 'Arduino',
39+
};
40+
}
41+
}

‎arduino-ide-extension/src/browser/contributions/debug.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/contributions/debug.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ export class Debug extends SketchContribution {
8383
this.boardsServiceProvider.onBoardsConfigChanged(({ selectedBoard }) =>
8484
this.refreshState(selectedBoard)
8585
);
86-
this.notificationCenter.onPlatformInstalled(() => this.refreshState());
87-
this.notificationCenter.onPlatformUninstalled(() => this.refreshState());
86+
this.notificationCenter.onPlatformDidInstall(() => this.refreshState());
87+
this.notificationCenter.onPlatformDidUninstall(() => this.refreshState());
8888
}
8989

9090
override onReady(): MaybePromise<void> {

‎arduino-ide-extension/src/browser/contributions/examples.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/contributions/examples.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ export class LibraryExamples extends Examples {
202202
protected readonly queue = new PQueue({ autoStart: true, concurrency: 1 });
203203

204204
override onStart(): void {
205-
this.notificationCenter.onLibraryInstalled(() => this.register());
206-
this.notificationCenter.onLibraryUninstalled(() => this.register());
205+
this.notificationCenter.onLibraryDidInstall(() => this.register());
206+
this.notificationCenter.onLibraryDidUninstall(() => this.register());
207207
}
208208

209209
override async onReady(): Promise<void> {

‎arduino-ide-extension/src/browser/contributions/include-library.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/contributions/include-library.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ export class IncludeLibrary extends SketchContribution {
4949
this.boardsServiceClient.onBoardsConfigChanged(() =>
5050
this.updateMenuActions()
5151
);
52-
this.notificationCenter.onLibraryInstalled(() => this.updateMenuActions());
53-
this.notificationCenter.onLibraryUninstalled(() =>
52+
this.notificationCenter.onLibraryDidInstall(() => this.updateMenuActions());
53+
this.notificationCenter.onLibraryDidUninstall(() =>
5454
this.updateMenuActions()
5555
);
5656
}
+71Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { Progress } from '@theia/core/lib/common/message-service-protocol';
2+
import { ProgressService } from '@theia/core/lib/common/progress-service';
3+
import { inject, injectable } from '@theia/core/shared/inversify';
4+
import { ProgressMessage } from '../../common/protocol';
5+
import { NotificationCenter } from '../notification-center';
6+
import { Contribution } from './contribution';
7+
8+
@injectable()
9+
export class IndexesUpdateProgress extends Contribution {
10+
@inject(NotificationCenter)
11+
private readonly notificationCenter: NotificationCenter;
12+
@inject(ProgressService)
13+
private readonly progressService: ProgressService;
14+
private currentProgress:
15+
| (Progress & Readonly<{ progressId: string }>)
16+
| undefined;
17+
18+
override onStart(): void {
19+
this.notificationCenter.onIndexWillUpdate((progressId) =>
20+
this.getOrCreateProgress(progressId)
21+
);
22+
this.notificationCenter.onIndexUpdateDidProgress((progress) => {
23+
this.getOrCreateProgress(progress).then((delegate) =>
24+
delegate.report(progress)
25+
);
26+
});
27+
this.notificationCenter.onIndexDidUpdate((progressId) => {
28+
this.cancelProgress(progressId);
29+
});
30+
this.notificationCenter.onIndexUpdateDidFail(({ progressId, message }) => {
31+
this.cancelProgress(progressId);
32+
this.messageService.error(message);
33+
});
34+
}
35+
36+
private async getOrCreateProgress(
37+
progressOrId: ProgressMessage | string
38+
): Promise<Progress & { progressId: string }> {
39+
const progressId = ProgressMessage.is(progressOrId)
40+
? progressOrId.progressId
41+
: progressOrId;
42+
if (this.currentProgress?.progressId === progressId) {
43+
return this.currentProgress;
44+
}
45+
if (this.currentProgress) {
46+
this.currentProgress.cancel();
47+
}
48+
this.currentProgress = undefined;
49+
const progress = await this.progressService.showProgress({
50+
text: '',
51+
options: { location: 'notification' },
52+
});
53+
if (ProgressMessage.is(progressOrId)) {
54+
progress.report(progressOrId);
55+
}
56+
this.currentProgress = { ...progress, progressId };
57+
return this.currentProgress;
58+
}
59+
60+
private cancelProgress(progressId: string) {
61+
if (this.currentProgress) {
62+
if (this.currentProgress.progressId !== progressId) {
63+
console.warn(
64+
`Mismatching progress IDs. Expected ${progressId}, got ${this.currentProgress.progressId}. Canceling anyway.`
65+
);
66+
}
67+
this.currentProgress.cancel();
68+
this.currentProgress = undefined;
69+
}
70+
}
71+
}

‎arduino-ide-extension/src/browser/contributions/open-recent-sketch.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/contributions/open-recent-sketch.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class OpenRecentSketch extends SketchContribution {
3636
protected toDisposeBeforeRegister = new Map<string, DisposableCollection>();
3737

3838
override onStart(): void {
39-
this.notificationCenter.onRecentSketchesChanged(({ sketches }) =>
39+
this.notificationCenter.onRecentSketchesDidChange(({ sketches }) =>
4040
this.refreshMenu(sketches)
4141
);
4242
}

‎arduino-ide-extension/src/browser/library/library-list-widget.ts

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/library/library-list-widget.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export class LibraryListWidget extends ListWidget<LibraryPackage> {
4141
protected override init(): void {
4242
super.init();
4343
this.toDispose.pushAll([
44-
this.notificationCenter.onLibraryInstalled(() => this.refresh(undefined)),
45-
this.notificationCenter.onLibraryUninstalled(() =>
44+
this.notificationCenter.onLibraryDidInstall(() => this.refresh(undefined)),
45+
this.notificationCenter.onLibraryDidUninstall(() =>
4646
this.refresh(undefined)
4747
),
4848
]);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.