mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-06-04 19:26: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> {
|
||||
this.sketchService.getSketchFiles(uri).then(uris => {
|
||||
for (const uri of uris) {
|
||||
this.editorManager.open(new URI(uri));
|
||||
}
|
||||
});
|
||||
const uris = await this.sketchService.getSketchFiles(uri);
|
||||
for (const uri of uris) {
|
||||
await this.editorManager.open(new URI(uri));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,22 +21,19 @@ export class ArduinoFrontendApplication extends FrontendApplication {
|
||||
protected readonly editorMode: EditorMode;
|
||||
|
||||
protected async initializeLayout(): Promise<void> {
|
||||
return super.initializeLayout().then(() => {
|
||||
// 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.
|
||||
// TODO: check `otherwise`. Also, what if we check for opened editors, instead of blindly opening them?
|
||||
if (!this.editorMode.proMode) {
|
||||
this.workspaceService.roots.then(roots => {
|
||||
for (const root of roots) {
|
||||
this.fileSystem.exists(root.uri).then(exists => {
|
||||
if (exists) {
|
||||
this.frontendContribution.openSketchFiles(root.uri);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
await super.initializeLayout();
|
||||
// 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.
|
||||
// TODO: check `otherwise`. Also, what if we check for opened editors, instead of blindly opening them?
|
||||
if (!this.editorMode.proMode) {
|
||||
const roots = await this.workspaceService.roots;
|
||||
for (const root of roots) {
|
||||
const exists = await this.fileSystem.exists(root.uri);
|
||||
if (exists) {
|
||||
await this.frontendContribution.openSketchFiles(root.uri);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user