Skip to content

Commit 4f58675

Browse files
author
Akos Kitta
committed
Merge branch 'main' into msujew/update-theia-1.24.0
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
2 parents 9ac4053 + b407d0a commit 4f58675

File tree

19 files changed

+2770
-963
lines changed

19 files changed

+2770
-963
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ body:
3737
id: os
3838
attributes:
3939
label: Operating system
40-
description: Which operating system are you using on your computer?
40+
description: Which operating system(s) are you using on your computer?
41+
multiple: true
4142
options:
4243
- Windows
4344
- Linux
4445
- macOS
46+
- N/A
4547
validations:
4648
required: true
4749
- type: input

.github/ISSUE_TEMPLATE/feature-request.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ body:
3232
id: os
3333
attributes:
3434
label: Operating system
35-
description: Which operating system are you using on your computer?
35+
description: Which operating system(s) are you using on your computer?
36+
multiple: true
3637
options:
3738
- Windows
3839
- Linux
3940
- macOS
41+
- N/A
4042
validations:
4143
required: true
4244
- type: input

.github/workflows/compose-full-changelog.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Create full changelog
3333
id: full-changelog
3434
run: |
35-
yarn add @octokit/rest
35+
yarn add @octokit/rest --ignore-workspace-root-check
3636
mkdir "${{ github.workspace }}/${{ env.CHANGELOG_ARTIFACTS }}"
3737
3838
# Get the changelog file name to build

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export class ArduinoFrontendContribution
157157
@inject(SketchesServiceClientImpl)
158158
protected readonly sketchServiceClient: SketchesServiceClientImpl;
159159

160+
@inject(FrontendApplicationStateService)
160161
protected readonly appStateService: FrontendApplicationStateService;
161162

162163
@inject(LocalStorageService)

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

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { injectable } from '@theia/core/shared/inversify';
1+
import { inject, injectable } from '@theia/core/shared/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,22 @@ import {
1111
KeybindingRegistry,
1212
} from './contribution';
1313
import { nls } from '@theia/core/lib/common';
14+
import { ApplicationShell, NavigatableWidget, Saveable } from '@theia/core/lib/browser';
15+
import { EditorManager } from '@theia/editor/lib/browser';
16+
import { WindowService } from '@theia/core/lib/browser/window/window-service';
1417

1518
@injectable()
1619
export class SaveAsSketch extends SketchContribution {
20+
21+
@inject(ApplicationShell)
22+
protected readonly applicationShell: ApplicationShell;
23+
24+
@inject(EditorManager)
25+
protected readonly editorManager: EditorManager;
26+
27+
@inject(WindowService)
28+
protected readonly windowService: WindowService;
29+
1730
registerCommands(registry: CommandRegistry): void {
1831
registry.registerCommand(SaveAsSketch.Commands.SAVE_AS_SKETCH, {
1932
execute: (args) => this.saveAs(args),
@@ -90,6 +103,9 @@ export class SaveAsSketch extends SketchContribution {
90103
const workspaceUri = await this.sketchService.copy(sketch, {
91104
destinationUri,
92105
});
106+
if (workspaceUri) {
107+
await this.saveOntoCopiedSketch(sketch.mainFileUri, sketch.uri, workspaceUri);
108+
}
93109
if (workspaceUri && openAfterMove) {
94110
if (wipeOriginal || (openAfterMove && execOnlyIfTemp)) {
95111
try {
@@ -100,12 +116,48 @@ export class SaveAsSketch extends SketchContribution {
100116
/* NOOP: from time to time, it's not possible to wipe the old resource from the temp dir on Windows */
101117
}
102118
}
119+
this.windowService.setSafeToShutDown();
103120
this.workspaceService.open(new URI(workspaceUri), {
104121
preserveWindow: true,
105122
});
106123
}
107124
return !!workspaceUri;
108125
}
126+
127+
private async saveOntoCopiedSketch(mainFileUri: string, sketchUri: string, newSketchUri: string): Promise<void> {
128+
const widgets = this.applicationShell.widgets;
129+
const snapshots = new Map<string, object>();
130+
for (const widget of widgets) {
131+
const saveable = Saveable.getDirty(widget);
132+
const uri = NavigatableWidget.getUri(widget);
133+
const uriString = uri?.toString();
134+
let relativePath: string;
135+
if (uri && uriString!.includes(sketchUri) && saveable && saveable.createSnapshot) {
136+
// The main file will change its name during the copy process
137+
// We need to store the new name in the map
138+
if (mainFileUri === uriString) {
139+
const lastPart = new URI(newSketchUri).path.base + uri.path.ext;
140+
relativePath = '/' + lastPart;
141+
} else {
142+
relativePath = uri.toString().substring(sketchUri.length);
143+
}
144+
snapshots.set(relativePath, saveable.createSnapshot());
145+
}
146+
}
147+
await Promise.all(Array.from(snapshots.entries()).map(async ([path, snapshot]) => {
148+
const widgetUri = new URI(newSketchUri + path);
149+
try {
150+
const widget = await this.editorManager.getOrCreateByUri(widgetUri);
151+
const saveable = Saveable.get(widget);
152+
if (saveable && saveable.applySnapshot) {
153+
saveable.applySnapshot(snapshot);
154+
await saveable.save();
155+
}
156+
} catch (e) {
157+
console.error(e);
158+
}
159+
}));
160+
}
109161
}
110162

111163
export namespace SaveAsSketch {

i18n/af.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"downloadingNotice": "Downloading the latest version of the Arduino IDE.",
2424
"updateAvailable": "Update Available",
2525
"newVersionAvailable": "A new version of Arduino IDE ({0}) is available for download.",
26-
"skipVersionButton": "Skip Version",
27-
"downloadButton": "Download",
26+
"skipVersionButton": "Volgende Weergawe",
27+
"downloadButton": "Aflaai",
2828
"goToDownloadPage": "An update for the Arduino IDE is available, but we're not able to download and install it automatically. Please go to the download page and download the latest version from there.",
2929
"goToDownloadButton": "Go To Download",
3030
"ideUpdaterDialog": "Software Update",
@@ -107,11 +107,11 @@
107107
"continue": "Continue",
108108
"pushSketch": "Push Sketch",
109109
"pushSketchMsg": "This is a Public Sketch. Before pushing, make sure any sensitive information is defined in arduino_secrets.h files. You can make a Sketch private from the Share panel.",
110-
"pull": "Pull",
110+
"pull": "Trek",
111111
"pullSketchMsg": "Pulling this Sketch from the Cloud will overwrite its local version. Are you sure you want to continue?",
112112
"donePulling": "Done pulling ‘{0}’.",
113113
"notYetPulled": "Cannot push to Cloud. It is not yet pulled.",
114-
"push": "Push",
114+
"push": "Stoot",
115115
"pullFirst": "You have to pull first to be able to push to the Cloud.",
116116
"donePushing": "Done pushing ‘{0}’.",
117117
"connected": "Connected",
@@ -131,7 +131,7 @@
131131
"succesfullyUninstalledPlatform": "Successfully uninstalled platform {0}:{1}",
132132
"couldNotFindPreviouslySelected": "Could not find previously selected board '{0}' in installed platform '{1}'. Please manually reselect the board you want to use. Do you want to reselect it now?",
133133
"reselectLater": "Herselekteer later",
134-
"noneSelected": "No boards selected.",
134+
"noneSelected": "Geen bord gekies nie.",
135135
"noPortsSelected": "No ports selected for board: '{0}'.",
136136
"noFQBN": "The FQBN is not available for the selected board \"{0}\". Do you have the corresponding core installed?",
137137
"openBoardsConfig": "Kies ander bord en poort...",

0 commit comments

Comments
 (0)