mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-06-08 13:16:33 +00:00
Wait when opening all files from a sketch folder.
This commit is a temporary workaround for eclipse-theia/theia#6298. Closes arduino/arduino-pro-ide#212. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
8cf019bc07
commit
2a2238bb82
@ -534,11 +534,10 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
|
|||||||
}
|
}
|
||||||
|
|
||||||
async openSketchFiles(uri: string): Promise<void> {
|
async openSketchFiles(uri: string): Promise<void> {
|
||||||
this.sketchService.getSketchFiles(uri).then(uris => {
|
const uris = await this.sketchService.getSketchFiles(uri);
|
||||||
for (const uri of uris) {
|
for (const uri of uris) {
|
||||||
this.editorManager.open(new URI(uri));
|
await this.editorManager.open(new URI(uri));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,22 +21,19 @@ export class ArduinoFrontendApplication extends FrontendApplication {
|
|||||||
protected readonly editorMode: EditorMode;
|
protected readonly editorMode: EditorMode;
|
||||||
|
|
||||||
protected async initializeLayout(): Promise<void> {
|
protected async initializeLayout(): Promise<void> {
|
||||||
return super.initializeLayout().then(() => {
|
await super.initializeLayout();
|
||||||
// If not in PRO mode, we open the sketch file with all the related files.
|
// If not in PRO mode, we open the sketch file with all the related files.
|
||||||
// Otherwise, we reuse the workbench's restore functionality and we do not open anything at all.
|
// Otherwise, we reuse the workbench's restore functionality and we do not open anything at all.
|
||||||
// TODO: check `otherwise`. Also, what if we check for opened editors, instead of blindly opening them?
|
// TODO: check `otherwise`. Also, what if we check for opened editors, instead of blindly opening them?
|
||||||
if (!this.editorMode.proMode) {
|
if (!this.editorMode.proMode) {
|
||||||
this.workspaceService.roots.then(roots => {
|
const roots = await this.workspaceService.roots;
|
||||||
for (const root of roots) {
|
for (const root of roots) {
|
||||||
this.fileSystem.exists(root.uri).then(exists => {
|
const exists = await this.fileSystem.exists(root.uri);
|
||||||
if (exists) {
|
if (exists) {
|
||||||
this.frontendContribution.openSketchFiles(root.uri);
|
await this.frontendContribution.openSketchFiles(root.uri);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user