@@ -2,39 +2,35 @@ const { CompositeDisposable } = require('atom')
2
2
3
3
let MinimapGitDiffBinding = null
4
4
5
- class MinimapGitDiff {
6
- constructor ( ) {
7
- this . pluginActive = false
8
- this . createBindings = this . createBindings . bind ( this )
9
- this . destroyBindings = this . destroyBindings . bind ( this )
10
- this . subscriptions = new CompositeDisposable ( )
11
- }
12
-
13
- get config ( ) {
14
- return {
15
- useGutterDecoration : {
16
- type : 'boolean' ,
17
- default : false ,
18
- description : 'When enabled the git diffs will be displayed as thin vertical lines on the left side of the minimap.' ,
19
- } ,
20
- }
21
- }
22
-
23
- isActive ( ) { return this . pluginActive }
5
+ module . exports = {
6
+ config : {
7
+ useGutterDecoration : {
8
+ type : 'boolean' ,
9
+ default : false ,
10
+ description : 'When enabled the git diffs will be displayed as thin vertical lines on the left side of the minimap.' ,
11
+ } ,
12
+ } ,
13
+
14
+ isActive ( ) {
15
+ return this . pluginActive
16
+ } ,
24
17
25
18
activate ( ) {
19
+ this . pluginActive = false
20
+ this . subscriptions = new CompositeDisposable ( )
26
21
this . bindings = new WeakMap ( )
27
- }
22
+ require ( 'atom-package-deps' ) . install ( 'minimap-git-diff' )
23
+ } ,
28
24
29
25
consumeMinimapServiceV1 ( minimap ) {
30
26
this . minimap = minimap
31
27
return this . minimap . registerPlugin ( 'git-diff' , this )
32
- }
28
+ } ,
33
29
34
30
deactivate ( ) {
35
31
this . destroyBindings ( )
36
32
this . minimap = null
37
- }
33
+ } ,
38
34
39
35
activatePlugin ( ) {
40
36
if ( this . pluginActive ) { return }
@@ -43,20 +39,20 @@ class MinimapGitDiff {
43
39
this . createBindings ( )
44
40
this . pluginActive = true
45
41
46
- this . subscriptions . add ( this . minimap . onDidActivate ( this . createBindings ) )
47
- this . subscriptions . add ( this . minimap . onDidDeactivate ( this . destroyBindings ) )
42
+ this . subscriptions . add ( this . minimap . onDidActivate ( this . createBindings . bind ( this ) ) )
43
+ this . subscriptions . add ( this . minimap . onDidDeactivate ( this . destroyBindings . bind ( this ) ) )
48
44
} catch ( e ) {
49
45
console . log ( e )
50
46
}
51
- }
47
+ } ,
52
48
53
49
deactivatePlugin ( ) {
54
50
if ( ! this . pluginActive ) { return }
55
51
56
52
this . pluginActive = false
57
53
this . subscriptions . dispose ( )
58
54
this . destroyBindings ( )
59
- }
55
+ } ,
60
56
61
57
createBindings ( ) {
62
58
if ( ! MinimapGitDiffBinding ) { MinimapGitDiffBinding = require ( './minimap-git-diff-binding' ) }
@@ -71,7 +67,7 @@ class MinimapGitDiff {
71
67
this . bindings . set ( minimap , binding )
72
68
} ) ,
73
69
)
74
- }
70
+ } ,
75
71
76
72
destroyBindings ( ) {
77
73
if ( ! this . minimap || ! this . minimap . editorsMinimaps ) { return }
@@ -82,7 +78,5 @@ class MinimapGitDiff {
82
78
}
83
79
this . bindings . delete ( minimap )
84
80
} )
85
- }
81
+ } ,
86
82
}
87
-
88
- module . exports = new MinimapGitDiff ( )
0 commit comments