Skip to content

Commit 473d82c

Browse files
committed
fix: return a real destroyed decoration
1 parent bd4eb25 commit 473d82c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/minimap.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
"use strict"
22

33
import { Emitter, CompositeDisposable, Disposable } from "atom"
4+
import Decoration from "./decoration"
45
import StableAdapter from "./adapters/stable-adapter"
56
import { editorsMinimaps } from "./main"
67

78
let nextModelId = 1
89

910
// returned in the decorations API when minimap is destoryed
10-
const destoryedDecorationMock = { destroyed: true }
1111
const disposedDisposable = new Disposable()
1212
disposedDisposable.dispose()
13+
const markerMock = {
14+
onDidDestroy: () => disposedDisposable,
15+
getScreenRange: () => ({}),
16+
}
17+
const destoryedDecoration = new Decoration(markerMock, null, {})
18+
destoryedDecoration.destroy()
1319

1420
/**
1521
* The Minimap class is the underlying model of a <MinimapElement>.
@@ -1142,16 +1148,16 @@ export default class Minimap {
11421148
return this.getDecorationManagement()?.onDidUpdateDecoration(...args) ?? disposedDisposable
11431149
}
11441150
decorationForId(...args) {
1145-
return this.getDecorationManagement()?.decorationForId(...args) ?? destoryedDecorationMock
1151+
return this.getDecorationManagement()?.decorationForId(...args) ?? destoryedDecoration
11461152
}
11471153
decorationsForScreenRowRange(...args) {
1148-
return this.getDecorationManagement()?.decorationsForScreenRowRange(...args) ?? destoryedDecorationMock
1154+
return this.getDecorationManagement()?.decorationsForScreenRowRange(...args) ?? destoryedDecoration
11491155
}
11501156
decorationsByTypeThenRows() {
1151-
return this.getDecorationManagement()?.decorationsByTypeThenRows() ?? destoryedDecorationMock
1157+
return this.getDecorationManagement()?.decorationsByTypeThenRows() ?? destoryedDecoration
11521158
}
11531159
decorateMarker(...args) {
1154-
return this.getDecorationManagement()?.decorateMarker(...args)
1160+
return this.getDecorationManagement()?.decorateMarker(...args) ?? destoryedDecoration
11551161
}
11561162
removeDecoration(...args) {
11571163
return this.getDecorationManagement()?.removeDecoration(...args)

0 commit comments

Comments
 (0)