Skip to content

Commit

Permalink
Update Theia to 1.22.1 (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew authored Feb 11, 2022
1 parent 69ac1f4 commit 112153f
Show file tree
Hide file tree
Showing 36 changed files with 727 additions and 1,411 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Install Node.js 12.x
- name: Install Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: '12.14.1'
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'

- name: Install Python 2.7
- name: Install Python 3.x
uses: actions/setup-python@v2
with:
python-version: '2.7'
python-version: '3.x'

- name: Package
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-i18n-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Node.js 12.x
- name: Install Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: '12.14.1'
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/i18n-nightly-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Install Node.js 12.x
- name: Install Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: '12.14.1'
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/i18n-weekly-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Install Node.js 12.x
- name: Install Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: '12.14.1'
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
Expand Down
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "std"
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Electron Frontend",
"port": 9222,
"webRoot": "${workspaceFolder}/electron-app"
},
{
"type": "node",
"request": "launch",
Expand Down Expand Up @@ -104,5 +111,14 @@
"program": "${workspaceRoot}/electron/packager/index.js",
"cwd": "${workspaceFolder}/electron/packager"
}
],
"compounds": [
{
"name": "Launch Electron Backend & Frontend",
"configurations": [
"App (Electron)",
"Attach to Electron Frontend"
]
}
]
}
5 changes: 2 additions & 3 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ The _frontend_ is running as an Electron renderer process and can invoke service
If you’re familiar with TypeScript, the [Theia IDE](https://theia-ide.org/), and if you want to contribute to the
project, you should be able to build the Arduino IDE locally.
Please refer to the [Theia IDE prerequisites](https://github.com/theia-ide/theia/blob/master/doc/) documentation for the setup instructions.
> **Note**: Node.js 14 must be used instead of the version 12 recommended at the link above.
Once you have all the tools installed, you can build the editor following these steps

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

3. Rebuild the electron dependencies
```sh
cd electron-app
yarn theia rebuild:electron
cd ..
yarn rebuild:electron
```

4. Start the application
Expand Down
33 changes: 17 additions & 16 deletions arduino-ide-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,23 @@
},
"dependencies": {
"@grpc/grpc-js": "^1.3.7",
"@theia/application-package": "1.19.0",
"@theia/core": "1.19.0",
"@theia/editor": "1.19.0",
"@theia/editor-preview": "1.19.0",
"@theia/filesystem": "1.19.0",
"@theia/git": "1.19.0",
"@theia/keymaps": "1.19.0",
"@theia/markers": "1.19.0",
"@theia/monaco": "1.19.0",
"@theia/navigator": "1.19.0",
"@theia/outline-view": "1.19.0",
"@theia/output": "1.19.0",
"@theia/preferences": "1.19.0",
"@theia/search-in-workspace": "1.19.0",
"@theia/terminal": "1.19.0",
"@theia/workspace": "1.19.0",
"@theia/application-package": "1.22.1",
"@theia/core": "1.22.1",
"@theia/editor": "1.22.1",
"@theia/editor-preview": "1.22.1",
"@theia/electron": "1.22.1",
"@theia/filesystem": "1.22.1",
"@theia/git": "1.22.1",
"@theia/keymaps": "1.22.1",
"@theia/markers": "1.22.1",
"@theia/monaco": "1.22.1",
"@theia/navigator": "1.22.1",
"@theia/outline-view": "1.22.1",
"@theia/output": "1.22.1",
"@theia/preferences": "1.22.1",
"@theia/search-in-workspace": "1.22.1",
"@theia/terminal": "1.22.1",
"@theia/workspace": "1.22.1",
"@tippyjs/react": "^4.2.5",
"@types/atob": "^2.1.2",
"@types/auth0-js": "^9.14.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { inject, injectable, postConstruct } from 'inversify';
import * as React from 'react';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import {
BoardsService,
SketchesService,
Expand Down
2 changes: 1 addition & 1 deletion arduino-ide-extension/src/browser/contributions/about.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { inject, injectable } from 'inversify';
import * as moment from 'moment';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { isOSX, isWindows } from '@theia/core/lib/common/os';
import { ClipboardService } from '@theia/core/lib/browser/clipboard-service';
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { ArduinoMenus } from '../menu/arduino-menus';
import {
SketchContribution,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import URI from '@theia/core/lib/common/uri';
import { ConfirmDialog } from '@theia/core/lib/browser/dialogs';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import * as dateFormat from 'dateformat';
import URI from '@theia/core/lib/common/uri';
import { ArduinoMenus } from '../menu/arduino-menus';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
import {
DisposableCollection,
Expand Down
2 changes: 1 addition & 1 deletion arduino-ide-extension/src/browser/contributions/close.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { inject, injectable } from 'inversify';
import { toArray } from '@phosphor/algorithm';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
import { ApplicationShell } from '@theia/core/lib/browser/shell/application-shell';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import URI from '@theia/core/lib/common/uri';
import { ArduinoMenus } from '../menu/arduino-menus';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { MaybePromise } from '@theia/core/lib/common/types';
import { Widget, ContextMenuRenderer } from '@theia/core/lib/browser';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { isOSX } from '@theia/core/lib/common/os';
import {
Contribution,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import * as dateFormat from 'dateformat';
import { ArduinoMenus } from '../menu/arduino-menus';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SerialModel } from '../serial-model';
import { ArduinoMenus } from '../../menu/arduino-menus';
import { Contribution } from '../../contributions/contribution';
import { Endpoint, FrontendApplication } from '@theia/core/lib/browser';
import { ipcRenderer } from '@theia/core/shared/electron';
import { ipcRenderer } from '@theia/electron/shared/electron';
import { SerialConfig } from '../../../common/protocol';
import { SerialConnectionManager } from '../serial-connection-manager';
import { SerialPlotter } from './protocol';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,15 @@ export class DebugSessionManager extends TheiaDebugSessionManager {
}
);
}
// TODO: remove as https://github.com/eclipse-theia/theia/issues/10164 is fixed
async terminateSessions(): Promise<void> {
await super.terminateSessions();
this.destroy(this.currentSession?.id);
async terminateSession(session?: DebugSession): Promise<void> {
if (!session) {
this.updateCurrentSession(this._currentSession);
session = this._currentSession;
}
// The cortex-debug extension does not respond to close requests
// So we simply terminate the debug session immediately
// Alternatively the `super.terminateSession` call will terminate it after 5 seconds without a response
await this.debug.terminateDebugSession(session!.id);
await super.terminateSession(session);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import URI from '@theia/core/lib/common/uri';
import { WorkspaceDeleteHandler as TheiaWorkspaceDeleteHandler } from '@theia/workspace/lib/browser/workspace-delete-handler';
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ArduinoWorkspaceRootResolver } from '../../arduino-workspace-resolver';
import { BoardsServiceProvider } from '../../boards/boards-service-provider';
import { BoardsConfig } from '../../boards/boards-config';
import { nls } from '@theia/core/lib/common';
import { URI as VSCodeUri } from '@theia/core/shared/vscode-uri';

@injectable()
export class WorkspaceService extends TheiaWorkspaceService {
Expand Down Expand Up @@ -67,14 +68,16 @@ export class WorkspaceService extends TheiaWorkspaceService {
this.workspaceUri = (async () => {
try {
const hash = window.location.hash;
const [recentWorkspaces, recentSketches] = await Promise.all([
const [recentWorkspacesPaths, recentSketches] = await Promise.all([
this.server.getRecentWorkspaces(),
this.sketchService
.getSketches({})
.then((container) =>
SketchContainer.toArray(container).map((s) => s.uri)
),
]);
// On Dindows, `getRecentWorkspaces` returns only file paths, not URIs as expected by the `isValid` method.
const recentWorkspaces = recentWorkspacesPaths.map(e => VSCodeUri.file(e).toString());
const toOpen = await new ArduinoWorkspaceRootResolver({
isValid: this.isValid.bind(this),
}).resolve({ hash, recentWorkspaces, recentSketches });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { inject, injectable } from 'inversify';
import { CommandRegistry } from '@theia/core/lib/common/command';
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
Expand Down Expand Up @@ -80,7 +80,7 @@ export class SketchbookWidgetContribution
}

onStart(): void {
this.shell.currentChanged.connect(() =>
this.shell.onDidChangeCurrentWidget(() =>
this.onCurrentWidgetChangedHandler()
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inject, injectable, postConstruct } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import {
ConnectionStatus,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { isOSX } from '@theia/core/lib/common/os';
import { Keybinding } from '@theia/core/lib/common/keybinding';
import {
Expand All @@ -15,7 +15,6 @@ import {
ArduinoMenus,
PlaceholderMenuNode,
} from '../../../browser/menu/arduino-menus';
import electron = require('@theia/core/shared/electron');

@injectable()
export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
Expand All @@ -35,9 +34,9 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
await this.preferencesService.ready;
const createdMenuBar = this.createElectronMenuBar();
if (isOSX) {
electron.remote.Menu.setApplicationMenu(createdMenuBar);
remote.Menu.setApplicationMenu(createdMenuBar);
} else {
electron.remote.getCurrentWindow().setMenu(createdMenuBar);
remote.getCurrentWindow().setMenu(createdMenuBar);
}
}

Expand Down Expand Up @@ -81,7 +80,7 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
protected createOSXMenu(): Electron.MenuItemConstructorOptions {
const { submenu } = super.createOSXMenu();
const label = 'Arduino IDE';
if (!!submenu && !(submenu instanceof remote.Menu)) {
if (!!submenu && Array.isArray(submenu)) {
const [, , /* about */ /* preferences */ ...rest] = submenu;
const about = this.fillMenuTemplate(
[],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { inject, injectable } from 'inversify';
import {
app,
BrowserWindow,
BrowserWindowConstructorOptions,
screen,
} from 'electron';
import { app, BrowserWindow, BrowserWindowConstructorOptions, ipcMain, screen } from '@theia/core/electron-shared/electron';
import { fork } from 'child_process';
import { AddressInfo } from 'net';
import { join } from 'path';
Expand All @@ -19,8 +14,8 @@ import {
TheiaBrowserWindowOptions,
} from '@theia/core/lib/electron-main/electron-main-application';
import { SplashServiceImpl } from '../splash/splash-service-impl';
import { ipcMain } from '@theia/core/shared/electron';
import { URI } from '@theia/core/shared/vscode-uri';
import * as electronRemoteMain from '@theia/core/electron-shared/@electron/remote/main';

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

Expand Down Expand Up @@ -209,6 +204,7 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
this.attachSaveWindowState(electronWindow);
this.attachGlobalShortcuts(electronWindow);
this.restoreMaximizedState(electronWindow, options);
electronRemoteMain.enable(electronWindow.webContents);
return electronWindow;
}

Expand Down
Loading

0 comments on commit 112153f

Please sign in to comment.