Skip to content

Commit 77ba0cb

Browse files
Akos Kittafstasi
authored andcommitted
[atl-1217] sketchbook explorer
Signed-off-by: Akos Kitta <kittaakos@typefox.io> Can render commands in the sketchbook tree. Signed-off-by: Akos Kitta <kittaakos@typefox.io> fixed children for generic folder. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Externalized the extensions into a single file. Signed-off-by: Akos Kitta <kittaakos@typefox.io> [dev]: Fixed the tasks. Signed-off-by: Akos Kitta <kittaakos@typefox.io> [dev]: Parse configs without `jsonc`. Signed-off-by: Akos Kitta <kittaakos@typefox.io> [doc]: Removed obsolete documentation. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Fixed the `name` and the `repository` link. Signed-off-by: Akos Kitta <kittaakos@typefox.io> [dev]: Use `rm -rf` for the clean-up. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Wiped the unused Dockerfile. Signed-off-by: Akos Kitta <kittaakos@typefox.io> open sketches commands Use template methods for the sketchbook trees. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Exported the sketchbook tree container API. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Fixed the icons. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Simplified the type-guard on `SketchDirNode`. No need to keep the full `sketch` object on the tree node. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Initialize the model with the CLI config object. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Added required dependencies. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Added `open`. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Fixed the scrollbar issue in sketchbook tree. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Removed the CLI config dependency from the widget. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Exposed the tree model to the command service. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Pinned `deepmerge` to `2.0.1`. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Fixed bug when executing the command for node. The even propagation has to be stopped to avoid tree expand/collapse if running the commands. Signed-off-by: Akos Kitta <kittaakos@typefox.io> [dev]: Reordered the launch configs. Signed-off-by: Akos Kitta <kittaakos@typefox.io> Sketchbook explorer
1 parent 8c4e66f commit 77ba0cb

35 files changed

+1011
-97
lines changed

.vscode/launch.json

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
52
"version": "0.2.0",
63
"configurations": [
7-
{
8-
"type": "node",
9-
"request": "attach",
10-
"name": "Attach by Process ID",
11-
"processId": "${command:PickProcess}"
12-
},
13-
{
14-
"type": "node",
15-
"request": "launch",
16-
"name": "Electron Packager",
17-
"program": "${workspaceRoot}/electron/packager/index.js",
18-
"cwd": "${workspaceFolder}/electron/packager"
19-
},
204
{
215
"type": "node",
226
"request": "launch",
@@ -106,6 +90,19 @@
10690
"smartStep": true,
10791
"internalConsoleOptions": "openOnSessionStart",
10892
"outputCapture": "std"
93+
},
94+
{
95+
"type": "node",
96+
"request": "attach",
97+
"name": "Attach by Process ID",
98+
"processId": "${command:PickProcess}"
99+
},
100+
{
101+
"type": "node",
102+
"request": "launch",
103+
"name": "Electron Packager",
104+
"program": "${workspaceRoot}/electron/packager/index.js",
105+
"cwd": "${workspaceFolder}/electron/packager"
109106
}
110107
]
111108
}

.vscode/tasks.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
// See https://go.microsoft.com/fwlink/?LinkId=733558
3-
// for the documentation about the tasks.json format
42
"version": "2.0.0",
53
"tasks": [
64
{
@@ -35,7 +33,7 @@
3533
"panel": "new",
3634
"clear": false
3735
}
38-
}
36+
},
3937
{
4038
"label": "Arduino IDE - Watch Browser App",
4139
"type": "shell",

Dockerfile

Lines changed: 0 additions & 19 deletions
This file was deleted.

arduino-ide-extension/package.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,18 @@
3333
"@theia/search-in-workspace": "next",
3434
"@theia/terminal": "next",
3535
"@theia/workspace": "next",
36+
"@types/atob": "^2.1.2",
37+
"@types/auth0-js": "^9.14.0",
38+
"@types/btoa": "^1.2.3",
3639
"@types/dateformat": "^3.0.1",
3740
"@types/deepmerge": "^2.2.0",
3841
"@types/glob": "^5.0.35",
3942
"@types/google-protobuf": "^3.7.2",
4043
"@types/js-yaml": "^3.12.2",
44+
"@types/keytar": "^4.4.0",
4145
"@types/lodash.debounce": "^4.0.6",
4246
"@types/ncp": "^2.0.4",
47+
"@types/node-fetch": "^2.5.7",
4348
"@types/ps-tree": "^1.1.0",
4449
"@types/react-select": "^3.0.0",
4550
"@types/react-tabs": "^2.3.2",
@@ -48,15 +53,24 @@
4853
"@types/which": "^1.3.1",
4954
"ajv": "^6.5.3",
5055
"async-mutex": "^0.3.0",
56+
"atob": "^2.1.2",
57+
"auth0-js": "^9.14.0",
58+
"btoa": "^1.2.1",
5159
"css-element-queries": "^1.2.0",
5260
"dateformat": "^3.0.3",
53-
"deepmerge": "^4.2.2",
61+
"deepmerge": "2.0.1",
5462
"fuzzy": "^0.1.3",
5563
"glob": "^7.1.6",
5664
"google-protobuf": "^3.11.4",
57-
"lodash.debounce": "^4.0.8",
65+
"hash.js": "^1.1.7",
66+
"is-valid-path": "^0.1.1",
5867
"js-yaml": "^3.13.1",
68+
"jwt-decode": "^3.1.2",
69+
"keytar": "7.2.0",
70+
"lodash.debounce": "^4.0.8",
5971
"ncp": "^2.0.0",
72+
"node-fetch": "^2.6.1",
73+
"open": "^8.0.6",
6074
"p-queue": "^5.0.0",
6175
"ps-tree": "^1.2.0",
6276
"react-disable": "^0.1.0",

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ import { NotificationManager } from './theia/messages/notifications-manager';
163163
import { NotificationManager as TheiaNotificationManager } from '@theia/messages/lib/browser/notifications-manager';
164164
import { NotificationsRenderer as TheiaNotificationsRenderer } from '@theia/messages/lib/browser/notifications-renderer';
165165
import { NotificationsRenderer } from './theia/messages/notifications-renderer';
166+
import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution';
167+
import { SketchbookWidget } from './widgets/sketchbook/sketchbook-widget';
168+
import { SketchbookTreeWidget } from './widgets/sketchbook/sketchbook-tree-widget';
169+
import { createSketchbookTreeWidget } from './widgets/sketchbook/sketchbook-tree-container';
166170

167171
const ElementQueries = require('css-element-queries/src/ElementQueries');
168172

@@ -448,4 +452,14 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
448452
rebind(TheiaNotificationManager).toService(NotificationManager);
449453
bind(NotificationsRenderer).toSelf().inSingletonScope();
450454
rebind(TheiaNotificationsRenderer).toService(NotificationsRenderer);
455+
456+
// UI for the Sketchbook
457+
bind(SketchbookWidget).toSelf();
458+
bindViewContribution(bind, SketchbookWidgetContribution);
459+
bind(FrontendApplicationContribution).toService(SketchbookWidgetContribution);
460+
bind(WidgetFactory).toDynamicValue(({ container }) => ({
461+
id: 'arduino-sketchbook-widget',
462+
createWidget: () => container.get(SketchbookWidget)
463+
}));
464+
bind(SketchbookTreeWidget).toDynamicValue(({ container }) => createSketchbookTreeWidget(container));
451465
});

arduino-ide-extension/src/browser/arduino-preferences.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ export const ArduinoConfigSchema: PreferenceSchema = {
4343
'type': 'boolean',
4444
'description': 'True to enable automatic update checks. The IDE will check for updates automatically and periodically.',
4545
'default': true
46+
},
47+
'arduino.sketchbook.showAllFiles': {
48+
'type': 'boolean',
49+
'description': 'True to show all sketch files inside the sketch. It is false by default.',
50+
'default': false
4651
}
4752
}
4853
};
@@ -56,6 +61,7 @@ export interface ArduinoConfiguration {
5661
'arduino.window.autoScale': boolean;
5762
'arduino.window.zoomLevel': number;
5863
'arduino.ide.autoUpdate': boolean;
64+
'arduino.sketchbook.showAllFiles': boolean;
5965
}
6066

6167
export const ArduinoPreferences = Symbol('ArduinoPreferences');

arduino-ide-extension/src/browser/data/arduino.color-theme.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@
8585
],
8686
"colors": {
8787
"list.highlightForeground": "#005c5f",
88-
"list.activeSelectionBackground": "#005c5f",
88+
"list.activeSelectionForeground": "#424242",
89+
"list.activeSelectionBackground": "#DAE3E3",
90+
"list.inactiveSelectionForeground": "#424242",
91+
"list.inactiveSelectionBackground": "#DAE3E3",
92+
"list.hoverBackground": "#ECF1F1",
8993
"progressBar.background": "#005c5f",
9094
"editor.background": "#ffffff",
9195
"editorCursor.foreground": "#434f54",

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export interface Settings extends Index {
3434
verboseOnUpload: boolean; // `arduino.upload.verbose`
3535
verifyAfterUpload: boolean; // `arduino.upload.verify`
3636
enableLsLogs: boolean; // `arduino.language.log`
37+
sketchbookShowAllFiles: boolean; // `arduino.sketchbook.showAllFiles`
3738

3839
sketchbookPath: string; // CLI
3940
additionalUrls: string[]; // CLI
@@ -94,7 +95,8 @@ export class SettingsService {
9495
verboseOnUpload,
9596
verifyAfterUpload,
9697
enableLsLogs,
97-
cliConfig
98+
sketchbookShowAllFiles,
99+
cliConfig,
98100
] = await Promise.all([
99101
this.preferenceService.get<number>('editor.fontSize', 12),
100102
this.preferenceService.get<string>('workbench.colorTheme', 'arduino-theme'),
@@ -112,6 +114,7 @@ export class SettingsService {
112114
this.preferenceService.get<boolean>('arduino.upload.verbose', true),
113115
this.preferenceService.get<boolean>('arduino.upload.verify', true),
114116
this.preferenceService.get<boolean>('arduino.language.log', true),
117+
this.preferenceService.get<boolean>('arduino.sketchbook.showAllFiles', false),
115118
this.configService.getConfiguration()
116119
]);
117120
const { additionalUrls, sketchDirUri, network } = cliConfig;
@@ -129,6 +132,7 @@ export class SettingsService {
129132
verboseOnUpload,
130133
verifyAfterUpload,
131134
enableLsLogs,
135+
sketchbookShowAllFiles,
132136
additionalUrls,
133137
sketchbookPath,
134138
network
@@ -194,7 +198,8 @@ export class SettingsService {
194198
enableLsLogs,
195199
sketchbookPath,
196200
additionalUrls,
197-
network
201+
network,
202+
sketchbookShowAllFiles
198203
} = this._settings;
199204
const [config, sketchDirUri] = await Promise.all([
200205
this.configService.getConfiguration(),
@@ -217,6 +222,7 @@ export class SettingsService {
217222
this.preferenceService.set('arduino.upload.verbose', verboseOnUpload, PreferenceScope.User),
218223
this.preferenceService.set('arduino.upload.verify', verifyAfterUpload, PreferenceScope.User),
219224
this.preferenceService.set('arduino.language.log', enableLsLogs, PreferenceScope.User),
225+
this.preferenceService.set('arduino.sketchbook.showAllFiles', sketchbookShowAllFiles, PreferenceScope.User),
220226
this.configService.setConfiguration(config)
221227
]);
222228
this.onDidChangeEmitter.fire(this._settings);
@@ -370,6 +376,13 @@ export class SettingsComponent extends React.Component<SettingsComponent.Props,
370376
onChange={this.autoSaveDidChange} />
371377
Auto save
372378
</label>
379+
<label className='flex-line'>
380+
<input
381+
type='checkbox'
382+
checked={this.state.sketchbookShowAllFiles === true}
383+
onChange={this.sketchbookShowAllFilesDidChange} />
384+
Sketchbook show files
385+
</label>
373386
<label className='flex-line'>
374387
<input
375388
type='checkbox'
@@ -564,6 +577,10 @@ export class SettingsComponent extends React.Component<SettingsComponent.Props,
564577
this.setState({ checkForUpdates: event.target.checked });
565578
};
566579

580+
protected sketchbookShowAllFilesDidChange = (event: React.ChangeEvent<HTMLInputElement>) => {
581+
this.setState({ sketchbookShowAllFiles: event.target.checked });
582+
};
583+
567584
protected autoSaveDidChange = (event: React.ChangeEvent<HTMLInputElement>) => {
568585
this.setState({ autoSave: event.target.checked ? 'on' : 'off' });
569586
};

arduino-ide-extension/src/browser/style/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
@import './editor.css';
99
@import './settings-dialog.css';
1010
@import './debug.css';
11+
@import './sketchbook.css';
1112

1213
.theia-input.warning:focus {
1314
outline-width: 1px;
Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)