Skip to content

Commit 112153f

Browse files
authored
Update Theia to 1.22.1 (#791)
1 parent 69ac1f4 commit 112153f

36 files changed

+727
-1411
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ jobs:
3333
- name: Checkout
3434
uses: actions/checkout@v2
3535

36-
- name: Install Node.js 12.x
36+
- name: Install Node.js 14.x
3737
uses: actions/setup-node@v1
3838
with:
39-
node-version: '12.14.1'
39+
node-version: '14.x'
4040
registry-url: 'https://registry.npmjs.org'
4141

42-
- name: Install Python 2.7
42+
- name: Install Python 3.x
4343
uses: actions/setup-python@v2
4444
with:
45-
python-version: '2.7'
45+
python-version: '3.x'
4646

4747
- name: Package
4848
shell: bash

.github/workflows/check-i18n-task.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
- name: Checkout repository
2626
uses: actions/checkout@v2
2727

28-
- name: Install Node.js 12.x
28+
- name: Install Node.js 14.x
2929
uses: actions/setup-node@v2
3030
with:
31-
node-version: '12.14.1'
31+
node-version: '14.x'
3232
registry-url: 'https://registry.npmjs.org'
3333

3434
- name: Install dependencies

.github/workflows/i18n-nightly-push.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
- name: Checkout
1313
uses: actions/checkout@v2
1414

15-
- name: Install Node.js 12.x
15+
- name: Install Node.js 14.x
1616
uses: actions/setup-node@v2
1717
with:
18-
node-version: '12.14.1'
18+
node-version: '14.x'
1919
registry-url: 'https://registry.npmjs.org'
2020

2121
- name: Install dependencies

.github/workflows/i18n-weekly-pull.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
- name: Checkout
1313
uses: actions/checkout@v2
1414

15-
- name: Install Node.js 12.x
15+
- name: Install Node.js 14.x
1616
uses: actions/setup-node@v2
1717
with:
18-
node-version: '12.14.1'
18+
node-version: '14.x'
1919
registry-url: 'https://registry.npmjs.org'
2020

2121
- name: Install dependencies

.vscode/launch.json

+16
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
"internalConsoleOptions": "openOnSessionStart",
3838
"outputCapture": "std"
3939
},
40+
{
41+
"type": "chrome",
42+
"request": "attach",
43+
"name": "Attach to Electron Frontend",
44+
"port": 9222,
45+
"webRoot": "${workspaceFolder}/electron-app"
46+
},
4047
{
4148
"type": "node",
4249
"request": "launch",
@@ -104,5 +111,14 @@
104111
"program": "${workspaceRoot}/electron/packager/index.js",
105112
"cwd": "${workspaceFolder}/electron/packager"
106113
}
114+
],
115+
"compounds": [
116+
{
117+
"name": "Launch Electron Backend & Frontend",
118+
"configurations": [
119+
"App (Electron)",
120+
"Attach to Electron Frontend"
121+
]
122+
}
107123
]
108124
}

BUILDING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The _frontend_ is running as an Electron renderer process and can invoke service
4242
If you’re familiar with TypeScript, the [Theia IDE](https://theia-ide.org/), and if you want to contribute to the
4343
project, you should be able to build the Arduino IDE locally.
4444
Please refer to the [Theia IDE prerequisites](https://github.com/theia-ide/theia/blob/master/doc/) documentation for the setup instructions.
45+
> **Note**: Node.js 14 must be used instead of the version 12 recommended at the link above.
4546
4647
Once you have all the tools installed, you can build the editor following these steps
4748

@@ -57,9 +58,7 @@ Once you have all the tools installed, you can build the editor following these
5758

5859
3. Rebuild the electron dependencies
5960
```sh
60-
cd electron-app
61-
yarn theia rebuild:electron
62-
cd ..
61+
yarn rebuild:electron
6362
```
6463

6564
4. Start the application

arduino-ide-extension/package.json

+17-16
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,23 @@
2121
},
2222
"dependencies": {
2323
"@grpc/grpc-js": "^1.3.7",
24-
"@theia/application-package": "1.19.0",
25-
"@theia/core": "1.19.0",
26-
"@theia/editor": "1.19.0",
27-
"@theia/editor-preview": "1.19.0",
28-
"@theia/filesystem": "1.19.0",
29-
"@theia/git": "1.19.0",
30-
"@theia/keymaps": "1.19.0",
31-
"@theia/markers": "1.19.0",
32-
"@theia/monaco": "1.19.0",
33-
"@theia/navigator": "1.19.0",
34-
"@theia/outline-view": "1.19.0",
35-
"@theia/output": "1.19.0",
36-
"@theia/preferences": "1.19.0",
37-
"@theia/search-in-workspace": "1.19.0",
38-
"@theia/terminal": "1.19.0",
39-
"@theia/workspace": "1.19.0",
24+
"@theia/application-package": "1.22.1",
25+
"@theia/core": "1.22.1",
26+
"@theia/editor": "1.22.1",
27+
"@theia/editor-preview": "1.22.1",
28+
"@theia/electron": "1.22.1",
29+
"@theia/filesystem": "1.22.1",
30+
"@theia/git": "1.22.1",
31+
"@theia/keymaps": "1.22.1",
32+
"@theia/markers": "1.22.1",
33+
"@theia/monaco": "1.22.1",
34+
"@theia/navigator": "1.22.1",
35+
"@theia/outline-view": "1.22.1",
36+
"@theia/output": "1.22.1",
37+
"@theia/preferences": "1.22.1",
38+
"@theia/search-in-workspace": "1.22.1",
39+
"@theia/terminal": "1.22.1",
40+
"@theia/workspace": "1.22.1",
4041
"@tippyjs/react": "^4.2.5",
4142
"@types/atob": "^2.1.2",
4243
"@types/auth0-js": "^9.14.0",

arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { inject, injectable, postConstruct } from 'inversify';
22
import * as React from 'react';
3-
import { remote } from 'electron';
3+
import * as remote from '@theia/core/electron-shared/@electron/remote';
44
import {
55
BoardsService,
66
SketchesService,

arduino-ide-extension/src/browser/contributions/about.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { inject, injectable } from 'inversify';
22
import * as moment from 'moment';
3-
import { remote } from 'electron';
3+
import * as remote from '@theia/core/electron-shared/@electron/remote';
44
import { isOSX, isWindows } from '@theia/core/lib/common/os';
55
import { ClipboardService } from '@theia/core/lib/browser/clipboard-service';
66
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';

arduino-ide-extension/src/browser/contributions/add-file.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { inject, injectable } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import { ArduinoMenus } from '../menu/arduino-menus';
44
import {
55
SketchContribution,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { inject, injectable } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import URI from '@theia/core/lib/common/uri';
44
import { ConfirmDialog } from '@theia/core/lib/browser/dialogs';
55
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';

arduino-ide-extension/src/browser/contributions/archive-sketch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { injectable } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import * as dateFormat from 'dateformat';
44
import URI from '@theia/core/lib/common/uri';
55
import { ArduinoMenus } from '../menu/arduino-menus';

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { inject, injectable } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
44
import {
55
DisposableCollection,

arduino-ide-extension/src/browser/contributions/close.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { inject, injectable } from 'inversify';
22
import { toArray } from '@phosphor/algorithm';
3-
import { remote } from 'electron';
3+
import * as remote from '@theia/core/electron-shared/@electron/remote';
44
import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
55
import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
66
import { ApplicationShell } from '@theia/core/lib/browser/shell/application-shell';

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { injectable } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import URI from '@theia/core/lib/common/uri';
44
import { ArduinoMenus } from '../menu/arduino-menus';
55
import {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { inject, injectable } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import { MaybePromise } from '@theia/core/lib/common/types';
44
import { Widget, ContextMenuRenderer } from '@theia/core/lib/browser';
55
import {

arduino-ide-extension/src/browser/contributions/quit-app.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { injectable } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import { isOSX } from '@theia/core/lib/common/os';
44
import {
55
Contribution,

arduino-ide-extension/src/browser/contributions/save-as-sketch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { injectable } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import * as dateFormat from 'dateformat';
44
import { ArduinoMenus } from '../menu/arduino-menus';
55
import {

arduino-ide-extension/src/browser/serial/plotter/plotter-frontend-contribution.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { SerialModel } from '../serial-model';
1010
import { ArduinoMenus } from '../../menu/arduino-menus';
1111
import { Contribution } from '../../contributions/contribution';
1212
import { Endpoint, FrontendApplication } from '@theia/core/lib/browser';
13-
import { ipcRenderer } from '@theia/core/shared/electron';
13+
import { ipcRenderer } from '@theia/electron/shared/electron';
1414
import { SerialConfig } from '../../../common/protocol';
1515
import { SerialConnectionManager } from '../serial-connection-manager';
1616
import { SerialPlotter } from './protocol';

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

+10-4
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,15 @@ export class DebugSessionManager extends TheiaDebugSessionManager {
6262
}
6363
);
6464
}
65-
// TODO: remove as https://github.com/eclipse-theia/theia/issues/10164 is fixed
66-
async terminateSessions(): Promise<void> {
67-
await super.terminateSessions();
68-
this.destroy(this.currentSession?.id);
65+
async terminateSession(session?: DebugSession): Promise<void> {
66+
if (!session) {
67+
this.updateCurrentSession(this._currentSession);
68+
session = this._currentSession;
69+
}
70+
// The cortex-debug extension does not respond to close requests
71+
// So we simply terminate the debug session immediately
72+
// Alternatively the `super.terminateSession` call will terminate it after 5 seconds without a response
73+
await this.debug.terminateDebugSession(session!.id);
74+
await super.terminateSession(session);
6975
}
7076
}

arduino-ide-extension/src/browser/theia/workspace/workspace-delete-handler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { inject, injectable } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import URI from '@theia/core/lib/common/uri';
44
import { WorkspaceDeleteHandler as TheiaWorkspaceDeleteHandler } from '@theia/workspace/lib/browser/workspace-delete-handler';
55
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';

arduino-ide-extension/src/browser/theia/workspace/workspace-service.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { ArduinoWorkspaceRootResolver } from '../../arduino-workspace-resolver';
1818
import { BoardsServiceProvider } from '../../boards/boards-service-provider';
1919
import { BoardsConfig } from '../../boards/boards-config';
2020
import { nls } from '@theia/core/lib/common';
21+
import { URI as VSCodeUri } from '@theia/core/shared/vscode-uri';
2122

2223
@injectable()
2324
export class WorkspaceService extends TheiaWorkspaceService {
@@ -67,14 +68,16 @@ export class WorkspaceService extends TheiaWorkspaceService {
6768
this.workspaceUri = (async () => {
6869
try {
6970
const hash = window.location.hash;
70-
const [recentWorkspaces, recentSketches] = await Promise.all([
71+
const [recentWorkspacesPaths, recentSketches] = await Promise.all([
7172
this.server.getRecentWorkspaces(),
7273
this.sketchService
7374
.getSketches({})
7475
.then((container) =>
7576
SketchContainer.toArray(container).map((s) => s.uri)
7677
),
7778
]);
79+
// On Dindows, `getRecentWorkspaces` returns only file paths, not URIs as expected by the `isValid` method.
80+
const recentWorkspaces = recentWorkspacesPaths.map(e => VSCodeUri.file(e).toString());
7881
const toOpen = await new ArduinoWorkspaceRootResolver({
7982
isValid: this.isValid.bind(this),
8083
}).resolve({ hash, recentWorkspaces, recentSketches });

arduino-ide-extension/src/browser/widgets/sketchbook/sketchbook-widget-contribution.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { remote } from 'electron';
1+
import * as remote from '@theia/core/electron-shared/@electron/remote';
22
import { inject, injectable } from 'inversify';
33
import { CommandRegistry } from '@theia/core/lib/common/command';
44
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
@@ -80,7 +80,7 @@ export class SketchbookWidgetContribution
8080
}
8181

8282
onStart(): void {
83-
this.shell.currentChanged.connect(() =>
83+
this.shell.onDidChangeCurrentWidget(() =>
8484
this.onCurrentWidgetChangedHandler()
8585
);
8686

arduino-ide-extension/src/electron-browser/electron-window-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { inject, injectable, postConstruct } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
44
import {
55
ConnectionStatus,

arduino-ide-extension/src/electron-browser/theia/core/electron-main-menu-factory.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { injectable } from 'inversify';
2-
import { remote } from 'electron';
2+
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import { isOSX } from '@theia/core/lib/common/os';
44
import { Keybinding } from '@theia/core/lib/common/keybinding';
55
import {
@@ -15,7 +15,6 @@ import {
1515
ArduinoMenus,
1616
PlaceholderMenuNode,
1717
} from '../../../browser/menu/arduino-menus';
18-
import electron = require('@theia/core/shared/electron');
1918

2019
@injectable()
2120
export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
@@ -35,9 +34,9 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
3534
await this.preferencesService.ready;
3635
const createdMenuBar = this.createElectronMenuBar();
3736
if (isOSX) {
38-
electron.remote.Menu.setApplicationMenu(createdMenuBar);
37+
remote.Menu.setApplicationMenu(createdMenuBar);
3938
} else {
40-
electron.remote.getCurrentWindow().setMenu(createdMenuBar);
39+
remote.getCurrentWindow().setMenu(createdMenuBar);
4140
}
4241
}
4342

@@ -81,7 +80,7 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
8180
protected createOSXMenu(): Electron.MenuItemConstructorOptions {
8281
const { submenu } = super.createOSXMenu();
8382
const label = 'Arduino IDE';
84-
if (!!submenu && !(submenu instanceof remote.Menu)) {
83+
if (!!submenu && Array.isArray(submenu)) {
8584
const [, , /* about */ /* preferences */ ...rest] = submenu;
8685
const about = this.fillMenuTemplate(
8786
[],

arduino-ide-extension/src/electron-main/theia/electron-main-application.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { inject, injectable } from 'inversify';
2-
import {
3-
app,
4-
BrowserWindow,
5-
BrowserWindowConstructorOptions,
6-
screen,
7-
} from 'electron';
2+
import { app, BrowserWindow, BrowserWindowConstructorOptions, ipcMain, screen } from '@theia/core/electron-shared/electron';
83
import { fork } from 'child_process';
94
import { AddressInfo } from 'net';
105
import { join } from 'path';
@@ -19,8 +14,8 @@ import {
1914
TheiaBrowserWindowOptions,
2015
} from '@theia/core/lib/electron-main/electron-main-application';
2116
import { SplashServiceImpl } from '../splash/splash-service-impl';
22-
import { ipcMain } from '@theia/core/shared/electron';
2317
import { URI } from '@theia/core/shared/vscode-uri';
18+
import * as electronRemoteMain from '@theia/core/electron-shared/@electron/remote/main';
2419

2520
app.commandLine.appendSwitch('disable-http-cache');
2621

@@ -209,6 +204,7 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
209204
this.attachSaveWindowState(electronWindow);
210205
this.attachGlobalShortcuts(electronWindow);
211206
this.restoreMaximizedState(electronWindow, options);
207+
electronRemoteMain.enable(electronWindow.webContents);
212208
return electronWindow;
213209
}
214210

0 commit comments

Comments
 (0)