Skip to content

Commit 51af711

Browse files
committed
Save all open editors before running Save As
1 parent c9b498f commit 51af711

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: arduino-ide-extension/src/browser/contributions/save-as-sketch.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { injectable } from 'inversify';
1+
import { inject, injectable } from 'inversify';
22
import * as remote from '@theia/core/electron-shared/@electron/remote';
33
import * as dateFormat from 'dateformat';
44
import { ArduinoMenus } from '../menu/arduino-menus';
@@ -11,9 +11,15 @@ import {
1111
KeybindingRegistry,
1212
} from './contribution';
1313
import { nls } from '@theia/core/lib/common';
14+
import { ApplicationShell } from '@theia/core/lib/browser';
15+
import { timeout } from '@theia/core/lib/common/promise-util';
1416

1517
@injectable()
1618
export class SaveAsSketch extends SketchContribution {
19+
20+
@inject(ApplicationShell)
21+
protected readonly applicationShell: ApplicationShell;
22+
1723
registerCommands(registry: CommandRegistry): void {
1824
registry.registerCommand(SaveAsSketch.Commands.SAVE_AS_SKETCH, {
1925
execute: (args) => this.saveAs(args),
@@ -87,6 +93,8 @@ export class SaveAsSketch extends SketchContribution {
8793
if (!destinationUri) {
8894
return false;
8995
}
96+
await this.applicationShell.saveAll();
97+
await timeout(20);
9098
const workspaceUri = await this.sketchService.copy(sketch, {
9199
destinationUri,
92100
});

0 commit comments

Comments
 (0)