File tree 1 file changed +12
-2
lines changed
arduino-ide-extension/src/browser/contributions
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 8
8
CommandRegistry ,
9
9
MenuModelRegistry ,
10
10
KeybindingRegistry ,
11
+ Sketch ,
11
12
URI ,
12
13
} from './contribution' ;
13
14
import { nls } from '@theia/core/lib/common' ;
@@ -47,12 +48,12 @@ export class Close extends SketchContribution {
47
48
return {
48
49
reason : 'temp-sketch' ,
49
50
action : ( ) => {
50
- return this . showTempSketchDialog ( ) ;
51
+ return this . showSaveTempSketchDialog ( ) ;
51
52
} ,
52
53
} ;
53
54
}
54
55
55
- private async showTempSketchDialog ( ) : Promise < boolean > {
56
+ private async showSaveTempSketchDialog ( ) : Promise < boolean > {
56
57
const sketch = await this . sketchServiceClient . currentSketch ( ) ;
57
58
if ( ! CurrentSketch . isValid ( sketch ) ) {
58
59
return true ;
@@ -61,6 +62,15 @@ export class Close extends SketchContribution {
61
62
if ( ! isTemp ) {
62
63
return true ;
63
64
}
65
+
66
+ // If non of the sketch files were ever touched, do not prompt the save dialog. (#1274)
67
+ const wereTouched = await Promise . all (
68
+ Sketch . uris ( sketch ) . map ( ( uri ) => this . wasTouched ( uri ) )
69
+ ) ;
70
+ if ( wereTouched . every ( ( wasTouched ) => ! Boolean ( wasTouched ) ) ) {
71
+ return true ;
72
+ }
73
+
64
74
const messageBoxResult = await remote . dialog . showMessageBox (
65
75
remote . getCurrentWindow ( ) ,
66
76
{
You can’t perform that action at this time.
0 commit comments