Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b49c11c

Browse files
author
Alberto Iannaccone
committed
fix rename and delete sketch
1 parent 3c13f70 commit b49c11c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

‎arduino-ide-extension/src/browser/contributions/sketch-control.ts‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class SketchControl extends SketchContribution {
8787
currentSketch &&
8888
parentsketch &&
8989
parentsketch.uri === currentSketch.uri &&
90-
(awaitthis.allowRename(parentsketch.uri))
90+
this.allowRename(parentsketch.uri)
9191
) {
9292
this.menuRegistry.registerMenuAction(
9393
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
@@ -124,7 +124,7 @@ export class SketchControl extends SketchContribution {
124124
currentSketch &&
125125
parentsketch &&
126126
parentsketch.uri === currentSketch.uri &&
127-
(awaitthis.allowDelete(parentsketch.uri))
127+
this.allowDelete(parentsketch.uri)
128128
) {
129129
this.menuRegistry.registerMenuAction(
130130
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
@@ -249,20 +249,24 @@ export class SketchControl extends SketchContribution {
249249
});
250250
}
251251

252-
protected async isCloudSketch(uri: string) {
253-
const cloudCacheLocation = this.localCacheFsProvider.from(new URI(uri));
252+
protected isCloudSketch(uri: string): boolean {
253+
try {
254+
const cloudCacheLocation = this.localCacheFsProvider.from(new URI(uri));
254255

255-
if (cloudCacheLocation) {
256-
return true;
256+
if (cloudCacheLocation) {
257+
return true;
258+
}
259+
return false;
260+
} catch {
261+
return false;
257262
}
258-
return false;
259263
}
260264

261-
protected asyncallowRename(uri: string) {
265+
protected allowRename(uri: string): boolean {
262266
return !this.isCloudSketch(uri);
263267
}
264268

265-
protected asyncallowDelete(uri: string) {
269+
protected allowDelete(uri: string): boolean {
266270
return !this.isCloudSketch(uri);
267271
}
268272
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /