Skip to content

Commit 4d5b820

Browse files
author
Akos Kitta
committed
Fixed the compiler erros after bumping to 1.25.0.
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 0d7b185 commit 4d5b820

File tree

11 files changed

+2958
-2862
lines changed

11 files changed

+2958
-2862
lines changed

arduino-ide-extension/package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@
2222
},
2323
"dependencies": {
2424
"@grpc/grpc-js": "^1.3.7",
25-
"@theia/application-package": "1.24.0",
26-
"@theia/core": "1.24.0",
27-
"@theia/editor": "1.24.0",
28-
"@theia/editor-preview": "1.24.0",
29-
"@theia/electron": "1.24.0",
30-
"@theia/filesystem": "1.24.0",
31-
"@theia/git": "1.24.0",
32-
"@theia/keymaps": "1.24.0",
33-
"@theia/markers": "1.24.0",
34-
"@theia/monaco": "1.24.0",
35-
"@theia/navigator": "1.24.0",
36-
"@theia/outline-view": "1.24.0",
37-
"@theia/output": "1.24.0",
38-
"@theia/preferences": "1.24.0",
39-
"@theia/search-in-workspace": "1.24.0",
40-
"@theia/terminal": "1.24.0",
41-
"@theia/workspace": "1.24.0",
25+
"@theia/application-package": "1.25.0",
26+
"@theia/core": "1.25.0",
27+
"@theia/editor": "1.25.0",
28+
"@theia/editor-preview": "1.25.0",
29+
"@theia/electron": "1.25.0",
30+
"@theia/filesystem": "1.25.0",
31+
"@theia/git": "1.25.0",
32+
"@theia/keymaps": "1.25.0",
33+
"@theia/markers": "1.25.0",
34+
"@theia/monaco": "1.25.0",
35+
"@theia/navigator": "1.25.0",
36+
"@theia/outline-view": "1.25.0",
37+
"@theia/output": "1.25.0",
38+
"@theia/preferences": "1.25.0",
39+
"@theia/search-in-workspace": "1.25.0",
40+
"@theia/terminal": "1.25.0",
41+
"@theia/workspace": "1.25.0",
4242
"@tippyjs/react": "^4.2.5",
4343
"@types/atob": "^2.1.2",
4444
"@types/auth0-js": "^9.14.0",

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
673673

674674
// Workaround for https://github.com/eclipse-theia/theia/issues/8722
675675
// Do not trigger a save on IDE startup if `"editor.autoSave": "on"` was set as a preference.
676+
// Note: `"editor.autoSave" was renamed to `"files.autoSave" and `"on"` was replaced with three
677+
// different cases, but we treat `!== 'off'` as auto save enabled. (https://github.com/eclipse-theia/theia/issues/10812)
676678
bind(EditorCommandContribution).toSelf().inSingletonScope();
677679
rebind(TheiaEditorCommandContribution).toService(EditorCommandContribution);
678680

arduino-ide-extension/src/browser/dialogs/certificate-uploader/certificate-add-new.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ export const CertificateAddComponent = ({
88
}): React.ReactElement => {
99
const [value, setValue] = React.useState('');
1010

11-
const handleChange = React.useCallback((event) => {
12-
setValue(event.target.value);
13-
}, []);
11+
const handleChange = React.useCallback(
12+
(event: React.ChangeEvent<HTMLInputElement>) => {
13+
setValue(event.target.value);
14+
},
15+
[]
16+
);
1417

1518
return (
1619
<form

arduino-ide-extension/src/browser/dialogs/settings/settings-component.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
import { nls } from '@theia/core/lib/common';
1818
import { Settings, SettingsService } from './settings';
1919
import { AdditionalUrlsDialog } from './settings-dialog';
20-
import { AsyncLocalizationProvider } from '@theia/core/lib/common/i18n/localization';
20+
import { AsyncLocalizationProvider, LanguageInfo } from '@theia/core/lib/common/i18n/localization';
2121

2222
export class SettingsComponent extends React.Component<
2323
SettingsComponent.Props,
@@ -213,11 +213,9 @@ export class SettingsComponent extends React.Component<
213213
value={this.state.currentLanguage}
214214
onChange={this.languageDidChange}
215215
>
216-
{this.state.languages.map((label) => (
217-
<option key={label} value={label}>
218-
{label}
219-
</option>
220-
))}
216+
{this.state.languages.map((label) =>
217+
this.toSelectOptions(label)
218+
)}
221219
</select>
222220
<span style={{ marginLeft: '5px' }}>
223221
(
@@ -275,7 +273,7 @@ export class SettingsComponent extends React.Component<
275273
<label className="flex-line">
276274
<input
277275
type="checkbox"
278-
checked={this.state.autoSave === 'on'}
276+
checked={this.state.autoSave !== 'off'}
279277
onChange={this.autoSaveDidChange}
280278
/>
281279
{nls.localize(
@@ -314,6 +312,22 @@ export class SettingsComponent extends React.Component<
314312
);
315313
}
316314

315+
private toSelectOptions(language: string | LanguageInfo): JSX.Element {
316+
const plain = typeof language === 'string';
317+
const key = plain ? language : language.languageId;
318+
const value = plain ? language : language.languageId;
319+
const label = plain
320+
? language
321+
: language.localizedLanguageName ||
322+
language.languageName ||
323+
language.languageId;
324+
return (
325+
<option key={key} value={value}>
326+
{label}
327+
</option>
328+
);
329+
}
330+
317331
protected renderNetwork(): React.ReactNode {
318332
return (
319333
<div className="content noselect">
@@ -549,7 +563,9 @@ export class SettingsComponent extends React.Component<
549563
protected autoSaveDidChange = (
550564
event: React.ChangeEvent<HTMLInputElement>
551565
): void => {
552-
this.setState({ autoSave: event.target.checked ? 'on' : 'off' });
566+
this.setState({
567+
autoSave: event.target.checked ? Settings.AutoSave.DEFAULT_ON : 'off',
568+
});
553569
};
554570

555571
protected quickSuggestionsOtherDidChange = (

arduino-ide-extension/src/browser/dialogs/settings/settings.tsx

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import {
1616
Network,
1717
} from '../../../common/protocol';
1818
import { CommandService, nls } from '@theia/core/lib/common';
19-
import { AsyncLocalizationProvider } from '@theia/core/lib/common/i18n/localization';
19+
import {
20+
AsyncLocalizationProvider,
21+
LanguageInfo,
22+
} from '@theia/core/lib/common/i18n/localization';
2023
import { ElectronCommands } from '@theia/core/lib/electron-browser/menu/electron-menu-contribution';
2124

2225
export const EDITOR_SETTING = 'editor';
@@ -39,10 +42,10 @@ export const SHOW_ALL_FILES_SETTING = `${SKETCHBOOK_SETTING}.showAllFiles`;
3942
export interface Settings {
4043
editorFontSize: number; // `editor.fontSize`
4144
themeId: string; // `workbench.colorTheme`
42-
autoSave: 'on' | 'off'; // `editor.autoSave`
45+
autoSave: Settings.AutoSave; // `files.autoSave`
4346
quickSuggestions: Record<'other' | 'comments' | 'strings', boolean>; // `editor.quickSuggestions`
4447

45-
languages: string[]; // `languages from the plugins`
48+
languages: (string | LanguageInfo)[]; // `languages from the plugins`
4649
currentLanguage: string;
4750

4851
autoScaleInterface: boolean; // `arduino.window.autoScale`
@@ -61,6 +64,14 @@ export namespace Settings {
6164
export function belongsToCli<K extends keyof Settings>(key: K): boolean {
6265
return key === 'sketchbookPath' || key === 'additionalUrls';
6366
}
67+
export type AutoSave =
68+
| 'off'
69+
| 'afterDelay'
70+
| 'onFocusChange'
71+
| 'onWindowChange';
72+
export namespace AutoSave {
73+
export const DEFAULT_ON: AutoSave = 'afterDelay'; // https://github.com/eclipse-theia/theia/issues/10812
74+
}
6475
}
6576

6677
@injectable()
@@ -126,7 +137,7 @@ export class SettingsService {
126137
'workbench.colorTheme',
127138
'arduino-theme'
128139
),
129-
this.preferenceService.get<'on' | 'off'>(AUTO_SAVE_SETTING, 'on'),
140+
this.loadAutoSaveSettings(),
130141
this.preferenceService.get<
131142
Record<'other' | 'comments' | 'strings', boolean>
132143
>(QUICK_SUGGESTIONS_SETTING, {
@@ -165,6 +176,25 @@ export class SettingsService {
165176
};
166177
}
167178

179+
private loadAutoSaveSettings(): Settings.AutoSave {
180+
// Renaming the preference and the possible values was a breaking change in Theia.
181+
// Here, we try to read the old key and value, and transform to the new state.
182+
// When writing the values to the preferences, we will always use the new key value.
183+
// https://github.com/eclipse-theia/theia/blame/1a7e6e0f4d048ba39e0ea66144e3551510ae46b1/CHANGELOG.md#L171
184+
const oldAutoSave = this.preferenceService.get('editor.autoSave');
185+
if (oldAutoSave === 'off') {
186+
return 'off';
187+
}
188+
if (oldAutoSave === 'on') {
189+
return Settings.AutoSave.DEFAULT_ON;
190+
}
191+
192+
return this.preferenceService.get<Settings.AutoSave>(
193+
AUTO_SAVE_SETTING,
194+
Settings.AutoSave.DEFAULT_ON
195+
);
196+
}
197+
168198
async settings(): Promise<Settings> {
169199
await this.ready.promise;
170200
return this._settings;

arduino-ide-extension/src/browser/theia/debug/debug-session-manager.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ export class DebugSessionManager extends TheiaDebugSessionManager {
2222
await this.fireWillStartDebugSession();
2323
const resolved = await this.resolveConfiguration(options);
2424

25+
//#region "cherry-picked" from here: https://github.com/eclipse-theia/theia/commit/e6b57ba4edabf797f3b4e67bc2968cdb8cc25b1e#diff-08e04edb57cd2af199382337aaf1dbdb31171b37ae4ab38a38d36cd77bc656c7R196-R207
26+
if (!resolved) {
27+
// As per vscode API: https://code.visualstudio.com/api/references/vscode-api#DebugConfigurationProvider
28+
// "Returning the value 'undefined' prevents the debug session from starting.
29+
// Returning the value 'null' prevents the debug session from starting and opens the
30+
// underlying debug configuration instead."
31+
32+
if (resolved === null) {
33+
this.debugConfigurationManager.openConfiguration();
34+
}
35+
return undefined;
36+
}
37+
//#endregion end of cherry-pick
38+
2539
// preLaunchTask isn't run in case of auto restart as well as postDebugTask
2640
if (!options.configuration.__restart) {
2741
const taskRun = await this.runTask(

browser-app/package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44
"version": "2.0.0-rc6",
55
"license": "AGPL-3.0-or-later",
66
"dependencies": {
7-
"@theia/core": "1.24.0",
8-
"@theia/debug": "1.24.0",
9-
"@theia/editor": "1.24.0",
10-
"@theia/editor-preview": "1.24.0",
11-
"@theia/file-search": "1.24.0",
12-
"@theia/filesystem": "1.24.0",
13-
"@theia/keymaps": "1.24.0",
14-
"@theia/messages": "1.24.0",
15-
"@theia/monaco": "1.24.0",
16-
"@theia/navigator": "1.24.0",
17-
"@theia/plugin-ext": "1.24.0",
18-
"@theia/plugin-ext-vscode": "1.24.0",
19-
"@theia/preferences": "1.24.0",
20-
"@theia/process": "1.24.0",
21-
"@theia/terminal": "1.24.0",
22-
"@theia/workspace": "1.24.0",
7+
"@theia/core": "1.25.0",
8+
"@theia/debug": "1.25.0",
9+
"@theia/editor": "1.25.0",
10+
"@theia/editor-preview": "1.25.0",
11+
"@theia/file-search": "1.25.0",
12+
"@theia/filesystem": "1.25.0",
13+
"@theia/keymaps": "1.25.0",
14+
"@theia/messages": "1.25.0",
15+
"@theia/monaco": "1.25.0",
16+
"@theia/navigator": "1.25.0",
17+
"@theia/plugin-ext": "1.25.0",
18+
"@theia/plugin-ext-vscode": "1.25.0",
19+
"@theia/preferences": "1.25.0",
20+
"@theia/process": "1.25.0",
21+
"@theia/terminal": "1.25.0",
22+
"@theia/workspace": "1.25.0",
2323
"arduino-ide-extension": "2.0.0-rc6"
2424
},
2525
"devDependencies": {
26-
"@theia/cli": "1.24.0"
26+
"@theia/cli": "1.25.0"
2727
},
2828
"scripts": {
2929
"prepare": "theia build --mode development",
@@ -36,7 +36,7 @@
3636
"applicationName": "Arduino IDE",
3737
"defaultTheme": "arduino-theme",
3838
"preferences": {
39-
"editor.autoSave": "on",
39+
"files.autoSave": "afterDelay",
4040
"editor.minimap.enabled": false,
4141
"editor.tabSize": 2,
4242
"editor.scrollBeyondLastLine": false,

electron-app/package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@
55
"license": "AGPL-3.0-or-later",
66
"main": "src-gen/frontend/electron-main.js",
77
"dependencies": {
8-
"@theia/core": "1.24.0",
9-
"@theia/debug": "1.24.0",
10-
"@theia/editor": "1.24.0",
11-
"@theia/editor-preview": "1.24.0",
12-
"@theia/electron": "1.24.0",
13-
"@theia/file-search": "1.24.0",
14-
"@theia/filesystem": "1.24.0",
15-
"@theia/keymaps": "1.24.0",
16-
"@theia/messages": "1.24.0",
17-
"@theia/monaco": "1.24.0",
18-
"@theia/navigator": "1.24.0",
19-
"@theia/plugin-ext": "1.24.0",
20-
"@theia/plugin-ext-vscode": "1.24.0",
21-
"@theia/preferences": "1.24.0",
22-
"@theia/process": "1.24.0",
23-
"@theia/terminal": "1.24.0",
24-
"@theia/workspace": "1.24.0",
8+
"@theia/core": "1.25.0",
9+
"@theia/debug": "1.25.0",
10+
"@theia/editor": "1.25.0",
11+
"@theia/editor-preview": "1.25.0",
12+
"@theia/electron": "1.25.0",
13+
"@theia/file-search": "1.25.0",
14+
"@theia/filesystem": "1.25.0",
15+
"@theia/keymaps": "1.25.0",
16+
"@theia/messages": "1.25.0",
17+
"@theia/monaco": "1.25.0",
18+
"@theia/navigator": "1.25.0",
19+
"@theia/plugin-ext": "1.25.0",
20+
"@theia/plugin-ext-vscode": "1.25.0",
21+
"@theia/preferences": "1.25.0",
22+
"@theia/process": "1.25.0",
23+
"@theia/terminal": "1.25.0",
24+
"@theia/workspace": "1.25.0",
2525
"arduino-ide-extension": "2.0.0-rc6"
2626
},
2727
"devDependencies": {
28-
"@theia/cli": "1.24.0",
28+
"@theia/cli": "1.25.0",
2929
"electron": "^15.3.5"
3030
},
3131
"scripts": {
@@ -40,7 +40,7 @@
4040
"applicationName": "Arduino IDE",
4141
"defaultTheme": "arduino-theme",
4242
"preferences": {
43-
"editor.autoSave": "on",
43+
"files.autoSave": "afterDelay",
4444
"editor.minimap.enabled": false,
4545
"editor.tabSize": 2,
4646
"editor.scrollBeyondLastLine": false,

electron/build/template-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"node-log-rotate": "^0.1.5"
1212
},
1313
"devDependencies": {
14-
"@theia/cli": "1.24.0",
14+
"@theia/cli": "1.25.0",
1515
"cross-env": "^7.0.2",
1616
"electron-builder": "22.10.5",
1717
"electron-notarize": "^1.1.1",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"node": ">=14.0.0 <15"
1111
},
1212
"devDependencies": {
13-
"@theia/cli": "1.24.0",
13+
"@theia/cli": "1.25.0",
1414
"@types/sinon": "^2.3.5",
1515
"@types/jsdom": "^11.0.4",
1616
"@typescript-eslint/eslint-plugin": "^4.27.0",
@@ -31,7 +31,7 @@
3131
"reflect-metadata": "^0.1.10",
3232
"rimraf": "^2.6.1",
3333
"semver": "^7.3.2",
34-
"typescript": "^4.5.5",
34+
"typescript": "~4.5.5",
3535
"jsdom": "^11.5.1"
3636
},
3737
"resolutions": {

0 commit comments

Comments
 (0)