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

Sign up
Appearance settings

Commit 5cb9166

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
Implemented filter and update all for libs/boards.
Closes #177 Closes #1188 Co-authored-by: Francesco Spissu <f.spissu@arduino.cc> Co-authored-by: Per Tillisch <p.tillisch@arduino.cc> Co-authored-by: Akos Kitta <a.kitta@arduino.cc> Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 7828cc1 commit 5cb9166

37 files changed

+1696
-220
lines changed

‎arduino-ide-extension/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
"version": {
164164
"owner": "arduino",
165165
"repo": "arduino-cli",
166-
"commitish": "63f1e18"
166+
"commitish": "05d1446"
167167
}
168168
},
169169
"fwuploader": {

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ import { FirstStartupInstaller } from './contributions/first-startup-installer';
314314
import { OpenSketchFiles } from './contributions/open-sketch-files';
315315
import { InoLanguage } from './contributions/ino-language';
316316
import { SelectedBoard } from './contributions/selected-board';
317-
import { CheckForUpdates } from './contributions/check-for-updates';
317+
import { CheckForIDEUpdates } from './contributions/check-for-ide-updates';
318318
import { OpenBoardsConfig } from './contributions/open-boards-config';
319319
import { SketchFilesTracker } from './contributions/sketch-files-tracker';
320320
import { MonacoThemeServiceIsReady } from './utils/window';
@@ -323,6 +323,15 @@ import { StatusBarImpl } from './theia/core/status-bar';
323323
import { StatusBarImpl as TheiaStatusBarImpl } from '@theia/core/lib/browser';
324324
import { EditorMenuContribution } from './theia/editor/editor-file';
325325
import { EditorMenuContribution as TheiaEditorMenuContribution } from '@theia/editor/lib/browser/editor-menu';
326+
import { PreferencesEditorWidget as TheiaPreferencesEditorWidget } from '@theia/preferences/lib/browser/views/preference-editor-widget';
327+
import { PreferencesEditorWidget } from './theia/preferences/preference-editor-widget';
328+
import { PreferencesWidget } from '@theia/preferences/lib/browser/views/preference-widget';
329+
import { createPreferencesWidgetContainer } from '@theia/preferences/lib/browser/views/preference-widget-bindings';
330+
import {
331+
BoardsFilterRenderer,
332+
LibraryFilterRenderer,
333+
} from './widgets/component-list/filter-renderer';
334+
import { CheckForUpdates } from './contributions/check-for-updates';
326335

327336
const registerArduinoThemes = () => {
328337
const themes: MonacoThemeJson[] = [
@@ -364,6 +373,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
364373

365374
// Renderer for both the library and the core widgets.
366375
bind(ListItemRenderer).toSelf().inSingletonScope();
376+
bind(LibraryFilterRenderer).toSelf().inSingletonScope();
377+
bind(BoardsFilterRenderer).toSelf().inSingletonScope();
367378

368379
// Library service
369380
bind(LibraryService)
@@ -737,9 +748,10 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
737748
Contribution.configure(bind, OpenSketchFiles);
738749
Contribution.configure(bind, InoLanguage);
739750
Contribution.configure(bind, SelectedBoard);
740-
Contribution.configure(bind, CheckForUpdates);
751+
Contribution.configure(bind, CheckForIDEUpdates);
741752
Contribution.configure(bind, OpenBoardsConfig);
742753
Contribution.configure(bind, SketchFilesTracker);
754+
Contribution.configure(bind, CheckForUpdates);
743755

744756
// Disabled the quick-pick customization from Theia when multiple formatters are available.
745757
// Use the default VS Code behavior, and pick the first one. In the IDE2, clang-format has `exclusive` selectors.
@@ -845,6 +857,18 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
845857
bind(DockPanelRenderer).toSelf();
846858
rebind(TheiaDockPanelRenderer).toService(DockPanelRenderer);
847859

860+
// Avoid running the "reset scroll" interval tasks until the preference editor opens.
861+
rebind(PreferencesWidget)
862+
.toDynamicValue(({ container }) => {
863+
const child = createPreferencesWidgetContainer(container);
864+
child.bind(PreferencesEditorWidget).toSelf().inSingletonScope();
865+
child
866+
.rebind(TheiaPreferencesEditorWidget)
867+
.toService(PreferencesEditorWidget);
868+
return child.get(PreferencesWidget);
869+
})
870+
.inSingletonScope();
871+
848872
// Preferences
849873
bindArduinoPreferences(bind);
850874

‎arduino-ide-extension/src/browser/arduino-preferences.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ export const ArduinoConfigSchema: PreferenceSchema = {
241241
),
242242
default: false,
243243
},
244+
'arduino.checkForUpdates': {
245+
type: 'boolean',
246+
description: nls.localize(
247+
'arduino/preferences/checkForUpdate',
248+
"Receive notifications of available updates for the IDE, boards, and libraries. Requires an IDE restart after change. It's true by default."
249+
),
250+
default: true,
251+
},
244252
},
245253
};
246254

@@ -270,6 +278,7 @@ export interface ArduinoConfiguration {
270278
'arduino.auth.registerUri': string;
271279
'arduino.survey.notification': boolean;
272280
'arduino.cli.daemon.debug': boolean;
281+
'arduino.checkForUpdates': boolean;
273282
}
274283

275284
export const ArduinoPreferences = Symbol('ArduinoPreferences');

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ 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';
15+
import { InstallManually } from '../../common/nls';
1516

1617
interface AutoInstallPromptAction {
1718
// isAcceptance, whether or not the action indicates acceptance of auto-install proposal
@@ -231,19 +232,18 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution {
231232
candidate: BoardsPackage
232233
): AutoInstallPromptActions {
233234
const yes = nls.localize('vscode/extensionsUtils/yes', 'Yes');
234-
const manualInstall = nls.localize(
235-
'arduino/board/installManually',
236-
'Install Manually'
237-
);
238235

239236
const actions: AutoInstallPromptActions = [
240237
{
241-
key: manualInstall,
238+
key: InstallManually,
242239
handler: () => {
243240
this.boardsManagerFrontendContribution
244241
.openView({ reveal: true })
245242
.then((widget) =>
246-
widget.refresh(candidate.name.toLocaleLowerCase())
243+
widget.refresh({
244+
query: candidate.name.toLocaleLowerCase(),
245+
type: 'All',
246+
})
247247
);
248248
},
249249
},

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@ import {
44
postConstruct,
55
} from '@theia/core/shared/inversify';
66
import {
7+
BoardSearch,
78
BoardsPackage,
89
BoardsService,
910
} from '../../common/protocol/boards-service';
1011
import { ListWidget } from '../widgets/component-list/list-widget';
1112
import { ListItemRenderer } from '../widgets/component-list/list-item-renderer';
1213
import { nls } from '@theia/core/lib/common';
14+
import { BoardsFilterRenderer } from '../widgets/component-list/filter-renderer';
1315

1416
@injectable()
15-
export class BoardsListWidget extends ListWidget<BoardsPackage> {
17+
export class BoardsListWidget extends ListWidget<BoardsPackage,BoardSearch> {
1618
static WIDGET_ID = 'boards-list-widget';
1719
static WIDGET_LABEL = nls.localize('arduino/boardsManager', 'Boards Manager');
1820

1921
constructor(
20-
@inject(BoardsService) protectedservice: BoardsService,
21-
@inject(ListItemRenderer)
22-
protecteditemRenderer: ListItemRenderer<BoardsPackage>
22+
@inject(BoardsService) service: BoardsService,
23+
@inject(ListItemRenderer)itemRenderer: ListItemRenderer<BoardsPackage>,
24+
@inject(BoardsFilterRenderer)filterRenderer: BoardsFilterRenderer
2325
) {
2426
super({
2527
id: BoardsListWidget.WIDGET_ID,
@@ -30,6 +32,8 @@ export class BoardsListWidget extends ListWidget<BoardsPackage> {
3032
itemLabel: (item: BoardsPackage) => item.name,
3133
itemDeprecated: (item: BoardsPackage) => item.deprecated,
3234
itemRenderer,
35+
filterRenderer,
36+
defaultSearchOptions: { query: '', type: 'All' },
3337
});
3438
}
3539

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import { injectable } from '@theia/core/shared/inversify';
22
import { BoardsListWidget } from './boards-list-widget';
3-
import { BoardsPackage } from '../../common/protocol/boards-service';
3+
import type {
4+
BoardSearch,
5+
BoardsPackage,
6+
} from '../../common/protocol/boards-service';
47
import { ListWidgetFrontendContribution } from '../widgets/component-list/list-widget-frontend-contribution';
58

69
@injectable()
7-
export class BoardsListWidgetFrontendContribution extends ListWidgetFrontendContribution<BoardsPackage> {
10+
export class BoardsListWidgetFrontendContribution extends ListWidgetFrontendContribution<
11+
BoardsPackage,
12+
BoardSearch
13+
> {
814
constructor() {
915
super({
1016
widgetId: BoardsListWidget.WIDGET_ID,
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { nls } from '@theia/core/lib/common/nls';
2+
import { LocalStorageService } from '@theia/core/lib/browser/storage-service';
3+
import { inject, injectable } from '@theia/core/shared/inversify';
4+
import {
5+
IDEUpdater,
6+
SKIP_IDE_VERSION,
7+
} from '../../common/protocol/ide-updater';
8+
import { IDEUpdaterDialog } from '../dialogs/ide-updater/ide-updater-dialog';
9+
import { Contribution } from './contribution';
10+
11+
@injectable()
12+
export class CheckForIDEUpdates extends Contribution {
13+
@inject(IDEUpdater)
14+
private readonly updater: IDEUpdater;
15+
16+
@inject(IDEUpdaterDialog)
17+
private readonly updaterDialog: IDEUpdaterDialog;
18+
19+
@inject(LocalStorageService)
20+
private readonly localStorage: LocalStorageService;
21+
22+
override onStart(): void {
23+
this.preferences.onPreferenceChanged(
24+
({ preferenceName, newValue, oldValue }) => {
25+
if (newValue !== oldValue) {
26+
switch (preferenceName) {
27+
case 'arduino.ide.updateChannel':
28+
case 'arduino.ide.updateBaseUrl':
29+
this.updater.init(
30+
this.preferences.get('arduino.ide.updateChannel'),
31+
this.preferences.get('arduino.ide.updateBaseUrl')
32+
);
33+
}
34+
}
35+
}
36+
);
37+
}
38+
39+
override onReady(): void {
40+
const checkForUpdates = this.preferences['arduino.checkForUpdates'];
41+
if (!checkForUpdates) {
42+
return;
43+
}
44+
this.updater
45+
.init(
46+
this.preferences.get('arduino.ide.updateChannel'),
47+
this.preferences.get('arduino.ide.updateBaseUrl')
48+
)
49+
.then(() => this.updater.checkForUpdates(true))
50+
.then(async (updateInfo) => {
51+
if (!updateInfo) return;
52+
const versionToSkip = await this.localStorage.getData<string>(
53+
SKIP_IDE_VERSION
54+
);
55+
if (versionToSkip === updateInfo.version) return;
56+
this.updaterDialog.open(updateInfo);
57+
})
58+
.catch((e) => {
59+
this.messageService.error(
60+
nls.localize(
61+
'arduino/ide-updater/errorCheckingForUpdates',
62+
'Error while checking for Arduino IDE updates.\n{0}',
63+
e.message
64+
)
65+
);
66+
});
67+
}
68+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /