2
2
3
3
/* @flow */
4
4
5
- import Breakpoint from './breakpoint'
6
- import DebuggerRegistry from './debugger-registry'
7
- import ProjectConfig from './project-config'
8
- import ViewRegistry from './view-registry'
5
+ import Breakpoint from './breakpoint'
6
+ import DebuggerRegistry from './debugger-registry'
7
+ import ProjectConfig from './project-config'
8
+ import ViewRegistry from './view-registry'
9
9
10
10
import type { Debugger , DebuggerView } from './types'
11
11
12
12
export default class DebuggerController {
13
13
debuggerRegistry : DebuggerRegistry ;
14
- viewRegistry : ViewRegistry ;
14
+ viewRegistry : ViewRegistry ;
15
15
16
16
constructor ( ) {
17
17
this . debuggerRegistry = new DebuggerRegistry ( )
18
- this . viewRegistry = new ViewRegistry ( this )
18
+ this . viewRegistry = new ViewRegistry ( this )
19
19
20
20
atom . commands . add ( 'atom-text-editor' , {
21
21
'debugger:start' : ( ) => { this . start ( ) } ,
@@ -24,7 +24,7 @@ export default class DebuggerController {
24
24
'debugger:pause' : ( ) => { this . pause ( ) } ,
25
25
'debugger:step-into' : ( ) => { this . stepInto ( ) } ,
26
26
'debugger:step-over' : ( ) => { this . stepOver ( ) } ,
27
- 'debugger:toggle-breakpoint-at-current-line' : ( ) => { this . toggleBreakpoint ( ) }
27
+ 'debugger:toggle-breakpoint-at-current-line' : ( ) => { this . toggleBreakpoint ( ) } ,
28
28
} )
29
29
}
30
30
@@ -33,7 +33,7 @@ export default class DebuggerController {
33
33
}
34
34
35
35
addView ( view : DebuggerView ) : void {
36
- this . viewRegistry . add ( view ) ;
36
+ this . viewRegistry . add ( view )
37
37
}
38
38
39
39
deleteView ( view : DebuggerView ) : void {
@@ -42,46 +42,40 @@ export default class DebuggerController {
42
42
43
43
/* Commands */
44
44
start ( ) : void {
45
- let proxy = this . debuggerRegistry . getDebuggerProxy ( )
46
- let config
45
+ const proxy = this . debuggerRegistry . getDebuggerProxy ( )
47
46
48
47
if ( proxy . getActiveDebugger ( ) != null ) {
49
-
50
48
atom . notifications . addError (
51
49
'There is a session in progress. Please, exit first.' )
52
50
53
51
return
54
52
}
55
53
56
- config = new ProjectConfig ( )
54
+ const config = new ProjectConfig ( )
57
55
config . tryLoad ( )
58
56
59
57
if ( ! config . data ) {
60
-
61
58
atom . notifications . addError ( 'The project has no config.' )
62
59
63
60
return
64
61
}
65
62
66
63
if ( ! config . data . target ) {
67
-
68
64
atom . notifications . addError ( 'The project has no target set.' )
69
65
70
66
return
71
67
}
72
68
73
69
if ( ! config . data . debugger ) {
74
-
75
70
atom . notifications . addError ( 'The project has no debugger set.' )
76
71
77
72
return
78
73
}
79
74
80
75
const target = config . data . target
81
- const debug = this . debuggerRegistry . get ( config . data . debugger )
76
+ const debug = this . debuggerRegistry . get ( config . data . debugger )
82
77
83
78
if ( ! debug ) {
84
-
85
79
atom . notifications . addFatalError ( 'The debugger is unknown.' )
86
80
87
81
return
@@ -117,14 +111,14 @@ export default class DebuggerController {
117
111
return
118
112
}
119
113
120
- let breakpoint = new Breakpoint ( {
121
- filePath : activeEditor . getPath ( ) ,
122
- bufferRow : activeEditor . getCursorBufferPosition ( ) . row
114
+ const breakpoint = new Breakpoint ( {
115
+ filePath : activeEditor . getPath ( ) ,
116
+ bufferRow : activeEditor . getCursorBufferPosition ( ) . row ,
123
117
} )
124
118
125
119
const debug = this . debuggerRegistry . getDebuggerProxy ( )
126
120
127
- if ( debug . removeBreakpoint ( breakpoint ) == false ) {
121
+ if ( debug . removeBreakpoint ( breakpoint ) === false ) {
128
122
debug . insertBreakpoint ( breakpoint )
129
123
}
130
124
}
0 commit comments