Skip to content

Commit 493ddc2

Browse files
committed
Initial draft for restoring browser app
1 parent 9ab87bf commit 493ddc2

File tree

13 files changed

+214
-3
lines changed

13 files changed

+214
-3
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module.exports = {
1414
'.browser_modules/*',
1515
'docs/*',
1616
'scripts/*',
17+
'browser-app/*',
1718
'electron-app/lib/*',
1819
'electron-app/src-gen/*',
1920
'electron-app/gen-webpack*.js',

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

.vscode/launch.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,37 @@
8080
"port": 9222,
8181
"webRoot": "${workspaceFolder}/electron-app"
8282
},
83+
{
84+
"type": "node",
85+
"request": "launch",
86+
"name": "App (Browser)",
87+
"program": "${workspaceRoot}/browser-app/src-gen/backend/main.js",
88+
"args": [
89+
"--hostname=0.0.0.0",
90+
"--port=3000",
91+
"--no-cluster",
92+
"--no-app-auto-install",
93+
"--plugins=local-dir:plugins"
94+
],
95+
"windows": {
96+
"env": {
97+
"NODE_ENV": "development",
98+
"NODE_PRESERVE_SYMLINKS": "1"
99+
}
100+
},
101+
"env": {
102+
"NODE_ENV": "development"
103+
},
104+
"sourceMaps": true,
105+
"outFiles": [
106+
"${workspaceRoot}/browser-app/src-gen/backend/*.js",
107+
"${workspaceRoot}/browser-app/lib/**/*.js",
108+
"${workspaceRoot}/arduino-ide-extension/lib/**/*.js"
109+
],
110+
"smartStep": true,
111+
"internalConsoleOptions": "openOnSessionStart",
112+
"outputCapture": "std"
113+
},
83114
{
84115
"type": "node",
85116
"request": "launch",

.vscode/tasks.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
"clear": false
1616
}
1717
},
18+
{
19+
"label": "Arduino IDE - Start Browser App",
20+
"type": "shell",
21+
"command": "yarn --cwd ./browser-app start",
22+
"group": "build",
23+
"presentation": {
24+
"reveal": "always",
25+
"panel": "new",
26+
"clear": true
27+
}
28+
},
1829
{
1930
"label": "Watch Extension",
2031
"type": "shell",
@@ -26,6 +37,17 @@
2637
"clear": false
2738
}
2839
},
40+
{
41+
"label": "Arduino IDE - Watch Browser App",
42+
"type": "shell",
43+
"command": "yarn --cwd ./browser-app watch",
44+
"group": "build",
45+
"presentation": {
46+
"reveal": "always",
47+
"panel": "new",
48+
"clear": false
49+
}
50+
},
2951
{
3052
"label": "Watch App",
3153
"type": "shell",
@@ -37,6 +59,14 @@
3759
"clear": false
3860
}
3961
},
62+
{
63+
"label": "Arduino IDE - Watch All [Browser]",
64+
"type": "shell",
65+
"dependsOn": [
66+
"Arduino IDE - Watch IDE Extension",
67+
"Arduino IDE - Watch Browser App"
68+
]
69+
},
4070
{
4171
"label": "Watch All",
4272
"type": "shell",

arduino-ide-extension/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@
158158
"frontend": "lib/browser/arduino-ide-frontend-module"
159159
},
160160
{
161+
"frontend": "lib/browser/theia/core/browser-menu-module",
161162
"frontendElectron": "lib/electron-browser/theia/core/electron-menu-module"
162163
},
163164
{
165+
"frontend": "lib/browser/theia/core/browser-window-module",
164166
"frontendElectron": "lib/electron-browser/theia/core/electron-window-module"
165167
},
166168
{
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { injectable } from '@theia/core/shared/inversify';
2+
import {
3+
BrowserMainMenuFactory as TheiaBrowserMainMenuFactory,
4+
MenuBarWidget,
5+
} from '@theia/core/lib/browser/menu/browser-menu-plugin';
6+
import { MainMenuManager } from '../../../common/main-menu-manager';
7+
8+
@injectable()
9+
export class BrowserMainMenuFactory
10+
extends TheiaBrowserMainMenuFactory
11+
implements MainMenuManager
12+
{
13+
protected menuBar: MenuBarWidget | undefined;
14+
15+
override createMenuBar(): MenuBarWidget {
16+
this.menuBar = super.createMenuBar();
17+
return this.menuBar;
18+
}
19+
20+
update(): void {
21+
if (this.menuBar) {
22+
this.menuBar.clearMenus();
23+
this.fillMenuBar(this.menuBar);
24+
}
25+
}
26+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import '../../../../src/browser/style/browser-menu.css';
2+
import { ContainerModule } from '@theia/core/shared/inversify';
3+
import {
4+
BrowserMenuBarContribution,
5+
BrowserMainMenuFactory as TheiaBrowserMainMenuFactory,
6+
} from '@theia/core/lib/browser/menu/browser-menu-plugin';
7+
import { MainMenuManager } from '../../../common/main-menu-manager';
8+
import { ArduinoMenuContribution } from './browser-menu-plugin';
9+
import { BrowserMainMenuFactory } from './browser-main-menu-factory';
10+
11+
export default new ContainerModule((bind, unbind, isBound, rebind) => {
12+
bind(BrowserMainMenuFactory).toSelf().inSingletonScope();
13+
bind(MainMenuManager).toService(BrowserMainMenuFactory);
14+
rebind(TheiaBrowserMainMenuFactory).toService(BrowserMainMenuFactory);
15+
rebind(BrowserMenuBarContribution)
16+
.to(ArduinoMenuContribution)
17+
.inSingletonScope();
18+
});

arduino-ide-extension/src/browser/theia/core/browser-window-module.ts

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { DefaultWindowService as TheiaDefaultWindowService } from '@theia/core/lib/browser/window/default-window-service';
2+
import { injectable } from '@theia/core/shared/inversify';
3+
import { WindowServiceExt } from './window-service-ext';
4+
5+
@injectable()
6+
export class DefaultWindowService
7+
extends TheiaDefaultWindowService
8+
implements WindowServiceExt
9+
{
10+
/**
11+
* The default implementation always resolves to `true`.
12+
* IDE2 does not use it. It's currently an electron-only app.
13+
*/
14+
async isFirstWindow(): Promise<boolean> {
15+
return true;
16+
}
17+
}

browser-app/package.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"private": true,
3+
"name": "browser-app",
4+
"version": "2.0.0",
5+
"license": "AGPL-3.0-or-later",
6+
"dependencies": {
7+
"@theia/core": "1.41.0",
8+
"@theia/debug": "1.41.0",
9+
"@theia/editor": "1.41.0",
10+
"@theia/file-search": "1.41.0",
11+
"@theia/filesystem": "1.41.0",
12+
"@theia/keymaps": "1.41.0",
13+
"@theia/messages": "1.41.0",
14+
"@theia/monaco": "1.41.0",
15+
"@theia/navigator": "1.41.0",
16+
"@theia/plugin-ext": "1.41.0",
17+
"@theia/plugin-ext-vscode": "1.41.0",
18+
"@theia/preferences": "1.41.0",
19+
"@theia/process": "1.41.0",
20+
"@theia/terminal": "1.41.0",
21+
"@theia/workspace": "1.41.0",
22+
"arduino-ide-extension": "2.3.5"
23+
},
24+
"devDependencies": {
25+
"@theia/cli": "1.41.0"
26+
},
27+
"scripts": {
28+
"prepare": "theia build --mode development",
29+
"start": "theia start --plugins=local-dir:../plugins",
30+
"watch": "theia build --watch --mode development"
31+
},
32+
"theia": {
33+
"frontend": {
34+
"config": {
35+
"applicationName": "Arduino IDE",
36+
"defaultTheme": "arduino-theme",
37+
"preferences": {
38+
"files.autoSave": "afterDelay",
39+
"editor.minimap.enabled": false,
40+
"editor.tabSize": 2,
41+
"editor.scrollBeyondLastLine": false,
42+
"editor.quickSuggestions": {
43+
"other": false,
44+
"comments": false,
45+
"strings": false
46+
},
47+
"breadcrumbs.enabled": false
48+
}
49+
}
50+
},
51+
"backend": {
52+
"config": {
53+
"configDirName": ".arduinoIDE"
54+
}
55+
},
56+
"generator": {
57+
"config": {
58+
"preloadTemplate": "<div class='theia-preload' style='background-color: rgb(237, 241, 242);'></div>"
59+
}
60+
}
61+
}
62+
}
63+

0 commit comments

Comments
 (0)