Skip to content

Commit 225967a

Browse files
author
Akos Kitta
committed
do not show error notification on sketch restore
Signed-off-by: Akos Kitta <[email protected]>
1 parent ee17fd4 commit 225967a

File tree

11 files changed

+111
-111
lines changed

11 files changed

+111
-111
lines changed

Diff for: arduino-ide-extension/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
],
156156
"arduino": {
157157
"cli": {
158-
"version": "0.24.0"
158+
"version": "0.25.0-rc1"
159159
},
160160
"fwuploader": {
161161
"version": "2.2.0"

Diff for: arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts

-2
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ import { WidgetManager as TheiaWidgetManager } from '@theia/core/lib/browser/wid
303303
import { StartupTasks } from './widgets/sketchbook/startup-task';
304304
import { IndexesUpdateProgress } from './contributions/indexes-update-progress';
305305
import { Daemon } from './contributions/daemon';
306-
import { Notifications } from './contributions/notifications';
307306
import { OpenSketchFiles } from './contributions/open-sketch-files';
308307
import { InoLanguage } from './contributions/ino-language';
309308
import { SelectedBoard } from './contributions/selected-board';
@@ -702,7 +701,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
702701
Contribution.configure(bind, StartupTasks);
703702
Contribution.configure(bind, IndexesUpdateProgress);
704703
Contribution.configure(bind, Daemon);
705-
Contribution.configure(bind, Notifications);
706704
Contribution.configure(bind, OpenSketchFiles);
707705
Contribution.configure(bind, InoLanguage);
708706
Contribution.configure(bind, SelectedBoard);

Diff for: arduino-ide-extension/src/browser/contributions/notifications.ts

-52
This file was deleted.

Diff for: arduino-ide-extension/src/browser/contributions/open-sketch-files.ts

+3-32
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ApplicationError } from '@theia/core/lib/common/application-error';
21
import { nls } from '@theia/core/lib/common/nls';
32
import { injectable } from '@theia/core/shared/inversify';
43
import type { EditorOpenerOptions } from '@theia/editor/lib/browser/editor-manager';
@@ -9,7 +8,6 @@ import {
98
SketchContribution,
109
URI,
1110
} from './contribution';
12-
import { Notifications } from './notifications';
1311
import { SaveAsSketch } from './save-as-sketch';
1412

1513
@injectable()
@@ -60,7 +58,7 @@ export class OpenSketchFiles extends SketchContribution {
6058
}
6159
} catch (err) {
6260
if (SketchesError.NotFound.is(err)) {
63-
this.openFallbackSketch(err);
61+
this.openFallbackSketch();
6462
} else {
6563
console.error(err);
6664
const message =
@@ -74,36 +72,9 @@ export class OpenSketchFiles extends SketchContribution {
7472
}
7573
}
7674

77-
private async openFallbackSketch(
78-
err: ApplicationError<
79-
number,
80-
{
81-
uri: string;
82-
}
83-
>
84-
): Promise<void> {
75+
private async openFallbackSketch(): Promise<void> {
8576
const sketch = await this.sketchService.createNewSketch();
86-
this.workspaceService.open(
87-
new URI(sketch.uri),
88-
Object.assign(
89-
{
90-
preserveWindow: true,
91-
},
92-
{
93-
tasks: [
94-
{
95-
command: Notifications.Commands.NOTIFY.id,
96-
args: [
97-
{
98-
type: 'error',
99-
message: err.message,
100-
},
101-
],
102-
},
103-
],
104-
}
105-
)
106-
);
77+
this.workspaceService.open(new URI(sketch.uri), { preserveWindow: true });
10778
}
10879

10980
private async ensureOpened(

Diff for: arduino-ide-extension/src/browser/theia/workspace/workspace-service.ts

+2-21
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { ConfigService } from '../../../common/protocol/config-service';
1717
import {
1818
SketchesService,
1919
Sketch,
20-
SketchesError,
2120
} from '../../../common/protocol/sketches-service';
2221
import { BoardsServiceProvider } from '../../boards/boards-service-provider';
2322
import { BoardsConfig } from '../../boards/boards-config';
@@ -70,30 +69,12 @@ export class WorkspaceService extends TheiaWorkspaceService {
7069
): Promise<FileStat | undefined> {
7170
const stat = await super.toFileStat(uri);
7271
if (!stat) {
73-
return this.toFileStatWithNewSketchFallback(uri);
72+
const newSketchUri = await this.sketchService.createNewSketch();
73+
return this.toFileStat(newSketchUri.uri);
7474
}
7575
return stat;
7676
}
7777

78-
private async toFileStatWithNewSketchFallback(
79-
uri: string | URI | undefined
80-
): Promise<FileStat | undefined> {
81-
if (!uri) {
82-
return;
83-
}
84-
try {
85-
await this.sketchService.loadSketch(
86-
uri instanceof URI ? uri.toString() : uri
87-
);
88-
} catch (err) {
89-
if (SketchesError.NotFound.is(err)) {
90-
this.messageService.error(err.message);
91-
}
92-
}
93-
const newSketchUri = await this.sketchService.createNewSketch();
94-
return this.toFileStat(newSketchUri.uri);
95-
}
96-
9778
// Was copied from the Theia implementation.
9879
// Unlike the default behavior, IDE2 does not check the existence of the workspace before open.
9980
protected override async doGetDefaultWorkspaceUri(): Promise<

Diff for: arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/compile_pb.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ export class CompileRequest extends jspb.Message {
9595
getEncryptKey(): string;
9696
setEncryptKey(value: string): CompileRequest;
9797

98+
getSkipLibrariesDiscovery(): boolean;
99+
setSkipLibrariesDiscovery(value: boolean): CompileRequest;
100+
98101

99102
serializeBinary(): Uint8Array;
100103
toObject(includeInstance?: boolean): CompileRequest.AsObject;
@@ -133,6 +136,7 @@ export namespace CompileRequest {
133136
keysKeychain: string,
134137
signKey: string,
135138
encryptKey: string,
139+
skipLibrariesDiscovery: boolean,
136140
}
137141
}
138142

Diff for: arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/compile_pb.js

+31-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ proto.cc.arduino.cli.commands.v1.CompileRequest.toObject = function(includeInsta
149149
libraryList: (f = jspb.Message.getRepeatedField(msg, 24)) == null ? undefined : f,
150150
keysKeychain: jspb.Message.getFieldWithDefault(msg, 25, ""),
151151
signKey: jspb.Message.getFieldWithDefault(msg, 26, ""),
152-
encryptKey: jspb.Message.getFieldWithDefault(msg, 27, "")
152+
encryptKey: jspb.Message.getFieldWithDefault(msg, 27, ""),
153+
skipLibrariesDiscovery: jspb.Message.getBooleanFieldWithDefault(msg, 28, false)
153154
};
154155

155156
if (includeInstance) {
@@ -286,6 +287,10 @@ proto.cc.arduino.cli.commands.v1.CompileRequest.deserializeBinaryFromReader = fu
286287
var value = /** @type {string} */ (reader.readString());
287288
msg.setEncryptKey(value);
288289
break;
290+
case 28:
291+
var value = /** @type {boolean} */ (reader.readBool());
292+
msg.setSkipLibrariesDiscovery(value);
293+
break;
289294
default:
290295
reader.skipField();
291296
break;
@@ -482,6 +487,13 @@ proto.cc.arduino.cli.commands.v1.CompileRequest.serializeBinaryToWriter = functi
482487
f
483488
);
484489
}
490+
f = message.getSkipLibrariesDiscovery();
491+
if (f) {
492+
writer.writeBool(
493+
28,
494+
f
495+
);
496+
}
485497
};
486498

487499

@@ -1016,6 +1028,24 @@ proto.cc.arduino.cli.commands.v1.CompileRequest.prototype.setEncryptKey = functi
10161028
};
10171029

10181030

1031+
/**
1032+
* optional bool skip_libraries_discovery = 28;
1033+
* @return {boolean}
1034+
*/
1035+
proto.cc.arduino.cli.commands.v1.CompileRequest.prototype.getSkipLibrariesDiscovery = function() {
1036+
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 28, false));
1037+
};
1038+
1039+
1040+
/**
1041+
* @param {boolean} value
1042+
* @return {!proto.cc.arduino.cli.commands.v1.CompileRequest} returns this
1043+
*/
1044+
proto.cc.arduino.cli.commands.v1.CompileRequest.prototype.setSkipLibrariesDiscovery = function(value) {
1045+
return jspb.Message.setProto3BooleanField(this, 28, value);
1046+
};
1047+
1048+
10191049

10201050
/**
10211051
* List of repeated fields within this message type.

Diff for: arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/core_pb.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export class PlatformInstallRequest extends jspb.Message {
2626
getSkipPostInstall(): boolean;
2727
setSkipPostInstall(value: boolean): PlatformInstallRequest;
2828

29+
getNoOverwrite(): boolean;
30+
setNoOverwrite(value: boolean): PlatformInstallRequest;
31+
2932

3033
serializeBinary(): Uint8Array;
3134
toObject(includeInstance?: boolean): PlatformInstallRequest.AsObject;
@@ -44,6 +47,7 @@ export namespace PlatformInstallRequest {
4447
architecture: string,
4548
version: string,
4649
skipPostInstall: boolean,
50+
noOverwrite: boolean,
4751
}
4852
}
4953

Diff for: arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/core_pb.js

+31-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.toObject = function(incl
339339
platformPackage: jspb.Message.getFieldWithDefault(msg, 2, ""),
340340
architecture: jspb.Message.getFieldWithDefault(msg, 3, ""),
341341
version: jspb.Message.getFieldWithDefault(msg, 4, ""),
342-
skipPostInstall: jspb.Message.getBooleanFieldWithDefault(msg, 5, false)
342+
skipPostInstall: jspb.Message.getBooleanFieldWithDefault(msg, 5, false),
343+
noOverwrite: jspb.Message.getBooleanFieldWithDefault(msg, 6, false)
343344
};
344345

345346
if (includeInstance) {
@@ -397,6 +398,10 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.deserializeBinaryFromRea
397398
var value = /** @type {boolean} */ (reader.readBool());
398399
msg.setSkipPostInstall(value);
399400
break;
401+
case 6:
402+
var value = /** @type {boolean} */ (reader.readBool());
403+
msg.setNoOverwrite(value);
404+
break;
400405
default:
401406
reader.skipField();
402407
break;
@@ -462,6 +467,13 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.serializeBinaryToWriter
462467
f
463468
);
464469
}
470+
f = message.getNoOverwrite();
471+
if (f) {
472+
writer.writeBool(
473+
6,
474+
f
475+
);
476+
}
465477
};
466478

467479

@@ -574,6 +586,24 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.prototype.setSkipPostIns
574586
};
575587

576588

589+
/**
590+
* optional bool no_overwrite = 6;
591+
* @return {boolean}
592+
*/
593+
proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.prototype.getNoOverwrite = function() {
594+
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false));
595+
};
596+
597+
598+
/**
599+
* @param {boolean} value
600+
* @return {!proto.cc.arduino.cli.commands.v1.PlatformInstallRequest} returns this
601+
*/
602+
proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.prototype.setNoOverwrite = function(value) {
603+
return jspb.Message.setProto3BooleanField(this, 6, value);
604+
};
605+
606+
577607

578608

579609

Diff for: arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/lib_pb.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ export class LibraryInstallRequest extends jspb.Message {
7979
getNoDeps(): boolean;
8080
setNoDeps(value: boolean): LibraryInstallRequest;
8181

82+
getNoOverwrite(): boolean;
83+
setNoOverwrite(value: boolean): LibraryInstallRequest;
84+
8285

8386
serializeBinary(): Uint8Array;
8487
toObject(includeInstance?: boolean): LibraryInstallRequest.AsObject;
@@ -96,6 +99,7 @@ export namespace LibraryInstallRequest {
9699
name: string,
97100
version: string,
98101
noDeps: boolean,
102+
noOverwrite: boolean,
99103
}
100104
}
101105

0 commit comments

Comments
 (0)