@@ -2,9 +2,10 @@ import { injectable, inject } from 'inversify';
2
2
import { MenuModelRegistry } from '@theia/core' ;
3
3
import { KeybindingRegistry } from '@theia/core/lib/browser' ;
4
4
import { TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar' ;
5
- import { DebugFrontendApplicationContribution } from '@theia/debug/lib/browser/debug-frontend-application-contribution' ;
5
+ import { DebugFrontendApplicationContribution , DebugCommands } from '@theia/debug/lib/browser/debug-frontend-application-contribution' ;
6
6
import { DebugSessionOptions } from "@theia/debug/lib/browser/debug-session-options" ;
7
7
import { EditorMode } from "arduino-ide-extension/lib/browser/editor-mode" ;
8
+ import { ArduinoDebugConfigurationManager } from './arduino-debug-configuration-manager' ;
8
9
9
10
@injectable ( )
10
11
export class ArduinoDebugFrontendApplicationContribution extends DebugFrontendApplicationContribution {
@@ -13,12 +14,12 @@ export class ArduinoDebugFrontendApplicationContribution extends DebugFrontendAp
13
14
protected readonly editorMode : EditorMode ;
14
15
15
16
async start ( noDebug ?: boolean , debugSessionOptions ?: DebugSessionOptions ) : Promise < void > {
16
- let current = debugSessionOptions ? debugSessionOptions : this . configurations . current ;
17
- // If no configurations are currently present, create the `launch.json` and prompt users to select the config.
17
+ const configurations = this . configurations as ArduinoDebugConfigurationManager ;
18
+ let current = debugSessionOptions ? debugSessionOptions : configurations . current ;
19
+ // If no configurations are currently present, create them
18
20
if ( ! current ) {
19
- await this . configurations . addConfiguration ( ) ;
20
- await this . configurations . load ( )
21
- current = this . configurations . current ;
21
+ await configurations . createDefaultConfiguration ( ) ;
22
+ current = configurations . current ;
22
23
}
23
24
if ( current ) {
24
25
if ( noDebug !== undefined ) {
@@ -35,24 +36,33 @@ export class ArduinoDebugFrontendApplicationContribution extends DebugFrontendAp
35
36
}
36
37
37
38
initializeLayout ( ) : Promise < void > {
38
- if ( this . editorMode . proMode )
39
+ if ( this . editorMode . proMode ) {
39
40
return super . initializeLayout ( ) ;
41
+ }
40
42
return Promise . resolve ( ) ;
41
43
}
42
44
43
45
registerMenus ( menus : MenuModelRegistry ) : void {
44
- if ( this . editorMode . proMode )
46
+ if ( this . editorMode . proMode ) {
45
47
super . registerMenus ( menus ) ;
48
+ menus . unregisterMenuAction ( DebugCommands . START_NO_DEBUG ) ;
49
+ }
46
50
}
47
51
48
52
registerKeybindings ( keybindings : KeybindingRegistry ) : void {
49
- if ( this . editorMode . proMode )
53
+ if ( this . editorMode . proMode ) {
50
54
super . registerKeybindings ( keybindings ) ;
55
+ keybindings . unregisterKeybinding ( {
56
+ command : DebugCommands . START_NO_DEBUG . id ,
57
+ keybinding : 'ctrl+f5'
58
+ } ) ;
59
+ }
51
60
}
52
61
53
62
registerToolbarItems ( toolbar : TabBarToolbarRegistry ) : void {
54
- if ( this . editorMode . proMode )
63
+ if ( this . editorMode . proMode ) {
55
64
super . registerToolbarItems ( toolbar ) ;
65
+ }
56
66
}
57
67
58
68
}
0 commit comments