@@ -20,6 +20,7 @@ import {
2020 FrontendApplication ,
2121 FrontendApplicationContribution ,
2222 LocalStorageService ,
23+ SaveableWidget ,
2324 StatusBar ,
2425 StatusBarAlignment ,
2526} from '@theia/core/lib/browser' ;
@@ -70,6 +71,7 @@ import { SaveAsSketch } from './contributions/save-as-sketch';
7071import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution' ;
7172import { IDEUpdaterDialog } from './dialogs/ide-updater/ide-updater-dialog' ;
7273import { IDEUpdater } from '../common/protocol/ide-updater' ;
74+ import { FileSystemFrontendContribution } from '@theia/filesystem/lib/browser/filesystem-frontend-contribution' ;
7375
7476const INIT_LIBS_AND_PACKAGES = 'initializedLibsAndPackages' ;
7577export const SKIP_IDE_VERSION = 'skipIDEVersion' ;
@@ -159,6 +161,9 @@ export class ArduinoFrontendContribution
159161 @inject ( LocalStorageService )
160162 protected readonly localStorageService : LocalStorageService ;
161163
164+ @inject ( FileSystemFrontendContribution )
165+ protected readonly fileSystemFrontendContribution : FileSystemFrontendContribution ;
166+
162167 @inject ( IDEUpdater )
163168 protected readonly updater : IDEUpdater ;
164169
@@ -337,6 +342,17 @@ export class ArduinoFrontendContribution
337342 } ) ;
338343
339344 app . shell . leftPanelHandler . removeBottomMenu ( 'settings-menu' ) ;
345+
346+ this . fileSystemFrontendContribution . onDidChangeEditorFile ( e => {
347+ if ( e . type === FileChangeType . DELETED ) {
348+ const editorWidget = e . editor ;
349+ if ( SaveableWidget . is ( editorWidget ) ) {
350+ editorWidget . closeWithoutSaving ( ) ;
351+ } else {
352+ editorWidget . close ( ) ;
353+ }
354+ }
355+ } ) ;
340356 }
341357
342358 onStop ( ) : void {
0 commit comments