Skip to content

Commit dc98d64

Browse files
committed
fix: add minimap as dependency
1 parent 38384ed commit dc98d64

File tree

3 files changed

+37
-30
lines changed

3 files changed

+37
-30
lines changed

lib/minimap-git-diff.js

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,35 @@ const { CompositeDisposable } = require('atom')
22

33
let MinimapGitDiffBinding = null
44

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+
},
2417

2518
activate () {
19+
this.pluginActive = false
20+
this.subscriptions = new CompositeDisposable()
2621
this.bindings = new WeakMap()
27-
}
22+
require('atom-package-deps').install('minimap-git-diff')
23+
},
2824

2925
consumeMinimapServiceV1 (minimap) {
3026
this.minimap = minimap
3127
return this.minimap.registerPlugin('git-diff', this)
32-
}
28+
},
3329

3430
deactivate () {
3531
this.destroyBindings()
3632
this.minimap = null
37-
}
33+
},
3834

3935
activatePlugin () {
4036
if (this.pluginActive) { return }
@@ -43,20 +39,20 @@ class MinimapGitDiff {
4339
this.createBindings()
4440
this.pluginActive = true
4541

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)))
4844
} catch (e) {
4945
console.log(e)
5046
}
51-
}
47+
},
5248

5349
deactivatePlugin () {
5450
if (!this.pluginActive) { return }
5551

5652
this.pluginActive = false
5753
this.subscriptions.dispose()
5854
this.destroyBindings()
59-
}
55+
},
6056

6157
createBindings () {
6258
if (!MinimapGitDiffBinding) { MinimapGitDiffBinding = require('./minimap-git-diff-binding') }
@@ -71,7 +67,7 @@ class MinimapGitDiff {
7167
this.bindings.set(minimap, binding)
7268
}),
7369
)
74-
}
70+
},
7571

7672
destroyBindings () {
7773
if (!this.minimap || !this.minimap.editorsMinimaps) { return }
@@ -82,7 +78,5 @@ class MinimapGitDiff {
8278
}
8379
this.bindings.delete(minimap)
8480
})
85-
}
81+
},
8682
}
87-
88-
module.exports = new MinimapGitDiff()

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
"lint": "eslint ."
1515
},
1616
"atomTestRunner": "./spec/runner.js",
17+
"package-deps": [
18+
{
19+
"name": "minimap"
20+
}
21+
],
22+
"dependencies": {
23+
"atom-package-deps": "^7.0.2"
24+
},
1725
"devDependencies": {
1826
"@semantic-release/apm-config": "^8.0.0",
1927
"atom-jasmine3-test-runner": "^5.1.8",

0 commit comments

Comments
 (0)