Skip to content

Commit ecce237

Browse files
author
Akos Kitta
committed
Updated to Theia 1.4.0-next.a62011a5.
- Aligned the daemon test to latest `js-yaml`. - Aligned the TS version with Theia. - Resolved a dependency-cycle with `next` Theia. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
1 parent ae6aec2 commit ecce237

File tree

6 files changed

+1777
-1449
lines changed

6 files changed

+1777
-1449
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ export namespace ArduinoCommands {
3838
id: 'arduino-open-file'
3939
}
4040

41+
/**
42+
* Unlike `OPEN_SKETCH`, it opens all files from a sketch folder. (ino, cpp, etc...)
43+
*/
44+
export const OPEN_SKETCH_FILES: Command = {
45+
id: 'arduino-open-sketch-files'
46+
}
47+
4148
export const SAVE_SKETCH: Command = {
4249
id: 'arduino-save-file'
4350
}

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
322322
}
323323
});
324324

325+
registry.registerCommand(ArduinoCommands.OPEN_SKETCH_FILES, {
326+
execute: async (uri: string) => {
327+
this.openSketchFiles(uri);
328+
}
329+
});
330+
325331
registry.registerCommand(ArduinoCommands.SAVE_SKETCH, {
326332
isVisible: widget => ArduinoToolbar.is(widget) && widget.side === 'left',
327333
execute: (sketch: Sketch) => {
@@ -548,7 +554,7 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
548554
});
549555
}
550556

551-
async openSketchFiles(uri: string): Promise<void> {
557+
protected async openSketchFiles(uri: string): Promise<void> {
552558
const uris = await this.sketchService.getSketchFiles(uri);
553559
for (const uri of uris) {
554560
await this.editorManager.open(new URI(uri));

arduino-ide-extension/src/browser/customization/arduino-frontend-application.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { injectable, inject } from 'inversify';
22
import { FileSystem } from '@theia/filesystem/lib/common/filesystem';
3+
import { CommandService } from '@theia/core/lib/common/command';
34
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
45
import { FrontendApplication } from '@theia/core/lib/browser/frontend-application';
56
import { EditorMode } from '../editor-mode';
6-
import { ArduinoFrontendContribution } from '../arduino-frontend-contribution';
7+
import { ArduinoCommands } from '../arduino-commands';
78

89
@injectable()
910
export class ArduinoFrontendApplication extends FrontendApplication {
@@ -14,8 +15,8 @@ export class ArduinoFrontendApplication extends FrontendApplication {
1415
@inject(WorkspaceService)
1516
protected readonly workspaceService: WorkspaceService;
1617

17-
@inject(ArduinoFrontendContribution)
18-
protected readonly frontendContribution: ArduinoFrontendContribution;
18+
@inject(CommandService)
19+
protected readonly commandService: CommandService;
1920

2021
@inject(EditorMode)
2122
protected readonly editorMode: EditorMode;
@@ -30,7 +31,7 @@ export class ArduinoFrontendApplication extends FrontendApplication {
3031
for (const root of roots) {
3132
const exists = await this.fileSystem.exists(root.uri);
3233
if (exists) {
33-
await this.frontendContribution.openSketchFiles(root.uri);
34+
await this.commandService.executeCommand(ArduinoCommands.OPEN_SKETCH_FILES.id, root.uri);
3435
}
3536
}
3637
}

arduino-ide-extension/src/test/node/arduino-daemon-impl.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SilentArduinoDaemonImpl extends ArduinoDaemonImpl {
3636
const destDir = track.mkdirSync();
3737
await spawnCommand(`"${cliPath}"`, ['config', 'init', '--dest-dir', destDir]);
3838
const content = fs.readFileSync(path.join(destDir, CLI_CONFIG), { encoding: 'utf8' });
39-
const cliConfig = safeLoad(content);
39+
const cliConfig = safeLoad(content) as any;
4040
cliConfig.daemon.port = String(this.port);
4141
const modifiedContent = safeDump(cliConfig);
4242
fs.writeFileSync(path.join(destDir, CLI_CONFIG), modifiedContent, { encoding: 'utf8' });

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lerna": "^3.20.2",
1212
"rimraf": "^2.6.1",
1313
"tslint": "^5.5.0",
14-
"typescript": "3.5.1"
14+
"typescript": "^3.9.2"
1515
},
1616
"scripts": {
1717
"prepare": "lerna run prepare && yarn test && yarn download:plugins",

0 commit comments

Comments
 (0)