|
1 | 1 | "use strict"
|
2 | 2 |
|
3 | 3 | import { Emitter, CompositeDisposable, Disposable } from "atom"
|
| 4 | +import Decoration from "./decoration" |
4 | 5 | import StableAdapter from "./adapters/stable-adapter"
|
5 | 6 | import { editorsMinimaps } from "./main"
|
6 | 7 |
|
7 | 8 | let nextModelId = 1
|
8 | 9 |
|
9 | 10 | // returned in the decorations API when minimap is destoryed
|
10 |
| -const destoryedDecorationMock = { destroyed: true } |
11 | 11 | const disposedDisposable = new Disposable()
|
12 | 12 | disposedDisposable.dispose()
|
| 13 | +const markerMock = { |
| 14 | + onDidDestroy: () => disposedDisposable, |
| 15 | + getScreenRange: () => ({}), |
| 16 | +} |
| 17 | +const destoryedDecoration = new Decoration(markerMock, null, {}) |
| 18 | +destoryedDecoration.destroy() |
13 | 19 |
|
14 | 20 | /**
|
15 | 21 | * The Minimap class is the underlying model of a <MinimapElement>.
|
@@ -1142,16 +1148,16 @@ export default class Minimap {
|
1142 | 1148 | return this.getDecorationManagement()?.onDidUpdateDecoration(...args) ?? disposedDisposable
|
1143 | 1149 | }
|
1144 | 1150 | decorationForId(...args) {
|
1145 |
| - return this.getDecorationManagement()?.decorationForId(...args) ?? destoryedDecorationMock |
| 1151 | + return this.getDecorationManagement()?.decorationForId(...args) ?? destoryedDecoration |
1146 | 1152 | }
|
1147 | 1153 | decorationsForScreenRowRange(...args) {
|
1148 |
| - return this.getDecorationManagement()?.decorationsForScreenRowRange(...args) ?? destoryedDecorationMock |
| 1154 | + return this.getDecorationManagement()?.decorationsForScreenRowRange(...args) ?? destoryedDecoration |
1149 | 1155 | }
|
1150 | 1156 | decorationsByTypeThenRows() {
|
1151 |
| - return this.getDecorationManagement()?.decorationsByTypeThenRows() ?? destoryedDecorationMock |
| 1157 | + return this.getDecorationManagement()?.decorationsByTypeThenRows() ?? destoryedDecoration |
1152 | 1158 | }
|
1153 | 1159 | decorateMarker(...args) {
|
1154 |
| - return this.getDecorationManagement()?.decorateMarker(...args) |
| 1160 | + return this.getDecorationManagement()?.decorateMarker(...args) ?? destoryedDecoration |
1155 | 1161 | }
|
1156 | 1162 | removeDecoration(...args) {
|
1157 | 1163 | return this.getDecorationManagement()?.removeDecoration(...args)
|
|
0 commit comments