8000 Merge 5e8a1f74c2c9cc3ca2582fb6aab66eafcebc7c62 into d24a3911f810a32de… · arduino/arduino-ide@b5afe99 · GitHub
[go: up one dir, main page]

Skip to content
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

Appearance settings

Commit b5afe99

Browse files
authored
Merge 5e8a1f7 into d24a391
2 parents d24a391 + 5e8a1f7 commit b5afe99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2994
-3652
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ build/
77
Examples/
88
!electron/build/
99
src-gen/
10-
!webpack.config.js
10+
webpack.config.js
1111
gen-webpack.config.js
1212
.DS_Store
1313
# switching from `electron` to `browser` in dev mode.
1414
.browser_modules
1515
yarn*.log
1616
# For the VS Code extensions used by Theia.
1717
plugins
18-
# the config files for the CLI
19-
arduino-ide-extension/data/cli/config
2018
# the tokens folder for the themes
2119
scripts/themes/tokens
2220
# environment variables

arduino-ide-extension/package.json

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@
2121
},
2222
"dependencies": {
2323
"@grpc/grpc-js": "^1.6.7",
24-
"@theia/application-package": "1.25.0",
25-
"@theia/core": "1.25.0",
26-
"@theia/editor": "1.25.0",
27-
"@theia/electron": "1.25.0",
28-
"@theia/filesystem": "1.25.0",
29-
"@theia/keymaps": "1.25.0",
30-
"@theia/markers": "1.25.0",
31-
"@theia/monaco": "1.25.0",
32-
"@theia/navigator": "1.25.0",
33-
"@theia/outline-view": "1.25.0",
34-
"@theia/output": "1.25.0",
35-
"@theia/preferences": "1.25.0",
36-
"@theia/search-in-workspace": "1.25.0",
37-
"@theia/terminal": "1.25.0",
38-
"@theia/workspace": "1.25.0",
24+
"@theia/application-package": "1.31.1",
25+
"@theia/core": "1.31.1",
26+
"@theia/editor": "1.31.1",
27+
"@theia/electron": "1.31.1",
28+
"@theia/filesystem": "1.31.1",
29+
"@theia/keymaps": "1.31.1",
30+
"@theia/markers": "1.31.1",
31+
"@theia/monaco": "1.31.1",
32+
"@theia/navigator": "1.31.1",
33+
"@theia/outline-view": "1.31.1",
34+
"@theia/output": "1.31.1",
35+
"@theia/preferences": "1.31.1",
36+
"@theia/search-in-workspace": "1.31.1",
37+
"@theia/terminal": "1.31.1",
38+
"@theia/workspace": "1.31.1",
3939
"@tippyjs/react": "^4.2.5",
4040
"@types/atob": "^2.1.2",
4141
"@types/auth0-js": "^9.14.0",
@@ -50,9 +50,10 @@
5050
"@types/lodash.debounce": "^4.0.6",
5151
"@types/ncp": "^2.0.4",
5252
"@types/node-fetch": "^2.5.7",
53+
"@types/p-queue": "^2.3.1",
5354
"@types/ps-tree": "^1.1.0",
54-
"@types/react-select": "^3.0.0",
5555
"@types/react-tabs": "^2.3.2",
56+
"@types/react-virtualized": "^9.21.21",
5657
"@types/temp": "^0.8.34",
5758
"@types/which": "^1.3.1",
5859
"ajv": "^6.5.3",
@@ -78,13 +79,14 @@
7879
"ncp": "^2.0.0",
7980
"node-fetch": "^2.6.1",
8081
"open": "^8.0.6",
81-
"p-queue": "^5.0.0",
82+
"p-queue": "^2.4.2",
8283
"ps-tree": "^1.2.0",
8384
"query-string": "^7.0.1",
84-
"react-disable": "^0.1.0",
85+
"react-disable": "^0.1.1",
8586
"react-markdown": "^8.0.0",
86-
"react-select": "^3.0.4",
87+
"react-select": "^5.6.0",
8788
"react-tabs": "^3.1.2",
89+
"react-virtualized": "^9.22.3",
8890
"react-window": "^1.8.6",
8991
"semver": "^7.3.2",
9092
"string-natural-compare": "^2.0.3",

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

Lines changed: 19 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import { ContainerModule } from '@theia/core/shared/inversify';
33
import { WidgetFactory } from '@theia/core/lib/browser/widget-manager';
44
import { CommandContribution } from '@theia/core/lib/common/command';
55
import { bindViewContribution } from '@theia/core/lib/browser/shell/view-contribution';
6-
import {
7-
TabBarToolbarContribution,
8-
TabBarToolbarFactory,
9-
} from '@theia/core/lib/browser/shell/tab-bar-toolbar';
6+
import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
107
import { WebSocketConnectionProvider } from '@theia/core/lib/browser/messaging/ws-connection-provider';
118
import {
129
FrontendApplicationContribution,
@@ -84,10 +81,7 @@ import { BoardsAutoInstaller } from './boards/boards-auto-installer';
8481
import { ShellLayoutRestorer } from './theia/core/shell-layout-restorer';
8582
import { ListItemRenderer } from './widgets/component-list/list-item-renderer';
8683
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
87-
import {
88-
MonacoThemeJson,
89-
MonacoThemingService,
90-
} from '@theia/monaco/lib/browser/monaco-theming-service';
84+
9185
import {
9286
ArduinoDaemonPath,
9387
ArduinoDaemon,
@@ -137,7 +131,6 @@ import { Settings } from './contributions/settings';
137131
import { WorkspaceCommandContribution } from './theia/workspace/workspace-commands';
138132
import { WorkspaceDeleteHandler as TheiaWorkspaceDeleteHandler } from '@theia/workspace/lib/browser/workspace-delete-handler';
139133
import { WorkspaceDeleteHandler } from './theia/workspace/workspace-delete-handler';
140-
import { TabBarToolbar } from './theia/core/tab-bar-toolbar';
141134
import { EditorWidgetFactory as TheiaEditorWidgetFactory } from '@theia/editor/lib/browser/editor-widget-factory';
142135
import { EditorWidgetFactory } from './theia/editor/editor-widget-factory';
143136
import { BurnBootloader } from './contributions/burn-bootloader';
@@ -181,8 +174,6 @@ import { EditorCommandContribution } from './theia/editor/editor-command';
181174
import { NavigatorTabBarDecorator as TheiaNavigatorTabBarDecorator } from '@theia/navigator/lib/browser/navigator-tab-bar-decorator';
182175
import { NavigatorTabBarDecorator } from './theia/navigator/navigator-tab-bar-decorator';
183176
import { Debug } from './contributions/debug';
184-
import { DebugSessionManager } from './theia/debug/debug-session-manager';
185-
import { DebugSessionManager as TheiaDebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager';
186177
import { Sketchbook } from './contributions/sketchbook';
187178
import { DebugFrontendApplicationContribution } from './theia/debug/debug-frontend-application-contribution';
188179
import { DebugFrontendApplicationContribution as TheiaDebugFrontendApplicationContribution } from '@theia/debug/lib/browser/debug-frontend-application-contribution';
@@ -313,10 +304,6 @@ import { SelectedBoard } from './contributions/selected-board';
313304
import { CheckForIDEUpdates } from './contributions/check-for-ide-updates';
314305
import { OpenBoardsConfig } from './contributions/open-boards-config';
315306
import { SketchFilesTracker } from './contributions/sketch-files-tracker';
316-
import { MonacoThemeServiceIsReady } from './utils/window';
317-
import { Deferred } from '@theia/core/lib/common/promise-util';
318-
import { StatusBarImpl } from './theia/core/status-bar';
319-
import { StatusBarImpl as TheiaStatusBarImpl } from '@theia/core/lib/browser';
320307
import { EditorMenuContribution } from './theia/editor/editor-file';
321308
import { EditorMenuContribution as TheiaEditorMenuContribution } from '@theia/editor/lib/browser/editor-menu';
322309
import { PreferencesEditorWidget as TheiaPreferencesEditorWidget } from '@theia/preferences/lib/browser/views/preference-editor-widget';
@@ -337,32 +324,12 @@ import { InterfaceScale } from './contributions/interface-scale';
337324
import { OpenHandler } from '@theia/core/lib/browser/opener-service';
338325
import { NewCloudSketch } from './contributions/new-cloud-sketch';
339326
import { SketchbookCompositeWidget } from './widgets/sketchbook/sketchbook-composite-widget';
340-
341-
const registerArduinoThemes = () => {
342-
const themes: MonacoThemeJson[] = [
343-
{
344-
id: 'arduino-theme',
345-
label: 'Light (Arduino)',
346-
uiTheme: 'vs',
347-
json: require('../../src/browser/data/default.color-theme.json'),
348-
},
349-
{
350-
id: 'arduino-theme-dark',
351-
label: 'Dark (Arduino)',
352-
uiTheme: 'vs-dark',
353-
json: require('../../src/browser/data/dark.color-theme.json'),
354-
},
355-
];
356-
themes.forEach((theme) => MonacoThemingService.register(theme))< 57AE /span>;
357-
};
358-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
359-
const global = window as any;
360-
const ready = global[MonacoThemeServiceIsReady] as Deferred;
361-
if (ready) {
362-
ready.promise.then(registerArduinoThemes);
363-
} else {
364-
registerArduinoThemes();
365-
}
327+
import { WindowTitleUpdater } from './theia/core/window-title-updater';
328+
import { WindowTitleUpdater as TheiaWindowTitleUpdater } from '@theia/core/lib/browser/window/window-title-updater';
329+
import { ThemeService } from './theia/core/theming';
330+
import { ThemeService as TheiaThemeService } from '@theia/core/lib/browser/theming';
331+
import { MonacoThemingService } from './theia/monaco/monaco-theming-service';
332+
import { MonacoThemingService as TheiaMonacoThemingService } from '@theia/monaco/lib/browser/monaco-theming-service';
366333

367334
export default new ContainerModule((bind, unbind, isBound, rebind) => {
368335
// Commands and toolbar items
@@ -587,14 +554,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
587554
.to(WorkspaceDeleteHandler)
588555
.inSingletonScope();
589556
rebind(TheiaEditorWidgetFactory).to(EditorWidgetFactory).inSingletonScope();
590-
rebind(TabBarToolbarFactory).toFactory(
591-
({ container: parentContainer }) =>
592-
() => {
593-
const container = parentContainer.createChild();
594-
container.bind(TabBarToolbar).toSelf().inSingletonScope();
595-
return container.get(TabBarToolbar);
596-
}
597-
);
598557
bind(OutputChannelManager).toSelf().inSingletonScope();
599558
rebind(TheiaOutputChannelManager).toService(OutputChannelManager);
600559
bind(OutputChannelRegistryMainImpl).toSelf().inTransientScope();
@@ -838,9 +797,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
838797
bind(AboutDialog).toSelf().inSingletonScope();
839798
rebind(TheiaAboutDialog).toService(AboutDialog);
840799

841-
// To avoid running `Save All` when there are no dirty editors before starting the debug session.
842-
bind(DebugSessionManager).toSelf().inSingletonScope();
843-
rebind(TheiaDebugSessionManager).toService(DebugSessionManager);
844800
// To remove the `Run` menu item from the application menu.
845801
bind(DebugFrontendApplicationContribution).toSelf().inSingletonScope();
846802
rebind(TheiaDebugFrontendApplicationContribution).toService(
@@ -854,10 +810,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
854810
bind(WidgetManager).toSelf().inSingletonScope();
855811
rebind(TheiaWidgetManager).toService(WidgetManager);
856812

857-
// To avoid running a status bar update on every single `keypress` event from the editor.
858-
bind(StatusBarImpl).toSelf().inSingletonScope();
859-
rebind(TheiaStatusBarImpl).toService(StatusBarImpl);
860-
861813
// Debounced update for the tab-bar toolbar when typing in the editor.
862814
bind(DockPanelRenderer).toSelf();
863815
rebind(TheiaDockPanelRenderer).toService(DockPanelRenderer);
@@ -942,7 +894,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
942894
bind(LocalCacheFsProvider).toSelf().inSingletonScope();
943895
bind(FileServiceContribution).toService(LocalCacheFsProvider);
944896
bind(CloudSketchbookCompositeWidget).toSelf();
945-
bind<WidgetFactory>(WidgetFactory).toDynamicValue((ctx) => ({
897+
bind(WidgetFactory).toDynamicValue((ctx) => ({
946898
id: 'cloud-sketchbook-composite-widget',
947899
createWidget: () => ctx.container.get(CloudSketchbookCompositeWidget),
948900
}));
@@ -991,4 +943,14 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
991943
rebind(TheiaHostedPluginSupport).toService(HostedPluginSupport);
992944
bind(HostedPluginEvents).toSelf().inSingletonScope();
993945
bind(FrontendApplicationContribution).toService(HostedPluginEvents);
946+
947+
// custom window titles
948+
bind(WindowTitleUpdater).toSelf().inSingletonScope();
949+
rebind(TheiaWindowTitleUpdater).toService(WindowTitleUpdater);
950+
951+
// register Arduino themes
952+
bind(ThemeService).toSelf().inSingletonScope();
953+
rebind(TheiaThemeService).toService(ThemeService);
954+
bind(MonacoThemingService).toSelf().inSingletonScope();
955+
rebind(TheiaMonacoThemingService).toService(MonacoThemingService);
994956
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export class SketchControl extends SketchContribution {
235235
});
236236
registry.registerKeybinding({
237237
command: CommonCommands.PREVIOUS_TAB.id,
238-
keybinding: 'CtrlCmd+Alt+Left', // TODO: check why electron does not show the keybindings in the UI.
238+
keybinding: 'CtrlCmd+Alt+Left',
239239
});
240240
registry.registerKeybinding({
241241
command: CommonCommands.NEXT_TAB.id,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { nls } from '@theia/core/lib/common';
22
import { shell } from 'electron';
33
import * as React from '@theia/core/shared/react';
4-
import * as ReactDOM from '@theia/core/shared/react-dom';
4+
import { createRoot } from '@theia/core/shared/react-dom/client';
55
import ReactMarkdown from 'react-markdown';
66
import { ProgressInfo, UpdateInfo } from '../../../common/protocol/ide-updater';
77
import ProgressBar from '../../components/ProgressBar';
@@ -30,6 +30,7 @@ export const IDEUpdaterComponent = ({
3030
const { version, releaseNotes } = updateInfo;
3131
const changelogDivRef =
3232
React.useRef() as React.MutableRefObject<HTMLDivElement>;
33+
const changelogRoot = createRoot(changelogDivRef.current);
3334
React.useEffect(() => {
3435
if (!!releaseNotes && changelogDivRef.current) {
3536
let changelog: string;
@@ -38,7 +39,7 @@ export const IDEUpdaterComponent = ({
3839
changelog = releaseNotes.reduce((acc, item) => {
3940
return item.note ? (acc += `${item.note}\n\n`) : acc;
4041
}, '');
41-
ReactDOM.render(
42+
changelogRoot.render(
4243
<ReactMarkdown
4344
components={{
4445
a: ({ href, children, ...props }) => (
@@ -49,8 +50,7 @@ export const IDEUpdaterComponent = ({
4950
}}
5051
>
5152
{changelog}
52-
</ReactMarkdown>,
53-
changelogDivRef.current
53+
</ReactMarkdown>
5454
);
5555
}
5656
}, [updateInfo]);

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,14 @@ export class SettingsComponent extends React.Component<
218218
<div className="flex-line">
219219
<select
220220
className="theia-select"
221-
value={ThemeService.get().getCurrentTheme().label}
221+
value={this.props.themeService.getCurrentTheme().label}
222222
onChange={this.themeDidChange}
223223
>
224-
{ThemeService.get()
225-
.getThemes()
226-
.map(({ id, label }) => (
227-
<option key={id} value={label}>
228-
{label}
229-
</option>
230-
))}
224+
{this.props.themeService.getThemes().map(({ id, label }) => (
225+
<option key={id} value={label}>
226+
{label}
227+
</option>
228+
))}
231229
</select>
232230
</div>
233231
<div className="flex-line">
@@ -612,11 +610,11 @@ export class SettingsComponent extends React.Component<
612610
event: React.ChangeEvent<HTMLSelectElement>
613611
): void => {
614612
const { selectedIndex } = event.target.options;
615-
const theme = ThemeService.get().getThemes()[selectedIndex];
613+
const theme = this.props.themeService.getThemes()[selectedIndex];
616614
if (theme) {
617615
this.setState({ themeId: theme.id });
618-
if (ThemeService.get().getCurrentTheme().id !== theme.id) {
619-
ThemeService.get().setCurrentTheme(theme.id);
616+
if (this.props.themeService.getCurrentTheme().id !== theme.id) {
617+
this.props.themeService.setCurrentTheme(theme.id);
620618
}
621619
}
622620
};
@@ -755,6 +753,7 @@ export namespace SettingsComponent {
755753
readonly fileDialogService: FileDialogService;
756754
readonly windowService: WindowService;
757755
readonly localizationProvider: AsyncLocalizationProvider;
756+
readonly themeService: ThemeService;
758757
}
759758
export type State = Settings & {
760759
rawAdditionalUrlsValue: string;

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export class SettingsWidget extends ReactWidget {
3535
@inject(AsyncLocalizationProvider)
3636
protected readonly localizationProvider: AsyncLocalizationProvider;
3737

38+
@inject(ThemeService)
39+
private readonly themeService: ThemeService;
40+
3841
protected render(): React.ReactNode {
3942
return (
4043
<SettingsComponent
@@ -43,6 +46,7 @@ export class SettingsWidget extends ReactWidget {
4346
fileDialogService={this.fileDialogService}
4447
windowService={this.windowService}
4548
localizationProvider={this.localizationProvider}
49+
themeService={this.themeService}
4650
/>
4751
);
4852
}
@@ -59,6 +63,9 @@ export class SettingsDialog extends AbstractDialog<Promise<Settings>> {
5963
@inject(SettingsWidget)
6064
protected readonly widget: SettingsWidget;
6165

66+
@inject(ThemeService)
67+
private readonly themeService: ThemeService;
68+
6269
constructor(
6370
@inject(SettingsDialogProps)
6471
protected override readonly props: SettingsDialogProps
@@ -121,11 +128,11 @@ export class SettingsDialog extends AbstractDialog<Promise<Settings>> {
121128
}
122129

123130
override async open(): Promise<Promise<Settings> | undefined> {
124-
const themeIdBeforeOpen = ThemeService.get().getCurrentTheme().id;
131+
const themeIdBeforeOpen = this.themeService.getCurrentTheme().id;
125132
const result = await super.open();
126133
if (!result) {
127-
if (ThemeService.get().getCurrentTheme().id !== themeIdBeforeOpen) {
128-
ThemeService.get().setCurrentTheme(themeIdBeforeOpen);
134+
if (this.themeService.getCurrentTheme().id !== themeIdBeforeOpen) {
135+
this.themeService.setCurrentTheme(themeIdBeforeOpen);
129136
}
130137
}
131138
return result;

0 commit comments

Comments
 (0)
0