Skip to content

Commit bd4eb25

Browse files
committed
fix: return destoryed decoration and disposable on fallback
1 parent f78fa69 commit bd4eb25

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/minimap.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import { editorsMinimaps } from "./main"
66

77
let nextModelId = 1
88

9+
// returned in the decorations API when minimap is destoryed
10+
const destoryedDecorationMock = { destroyed: true }
11+
const disposedDisposable = new Disposable()
12+
disposedDisposable.dispose()
13+
914
/**
1015
* The Minimap class is the underlying model of a <MinimapElement>.
1116
* Most manipulations of the minimap is done through the model.
@@ -1125,25 +1130,25 @@ export default class Minimap {
11251130
return this.getDecorationManagement()?.getDecorations() ?? []
11261131
}
11271132
onDidAddDecoration(...args) {
1128-
return this.getDecorationManagement()?.onDidAddDecoration(...args) ?? new Disposable()
1133+
return this.getDecorationManagement()?.onDidAddDecoration(...args) ?? disposedDisposable
11291134
}
11301135
onDidRemoveDecoration(...args) {
1131-
return this.getDecorationManagement()?.onDidRemoveDecoration(...args) ?? new Disposable()
1136+
return this.getDecorationManagement()?.onDidRemoveDecoration(...args) ?? disposedDisposable
11321137
}
11331138
onDidChangeDecorationRange(...args) {
1134-
return this.getDecorationManagement()?.onDidChangeDecorationRange(...args) ?? new Disposable()
1139+
return this.getDecorationManagement()?.onDidChangeDecorationRange(...args) ?? disposedDisposable
11351140
}
11361141
onDidUpdateDecoration(...args) {
1137-
return this.getDecorationManagement()?.onDidUpdateDecoration(...args) ?? new Disposable()
1142+
return this.getDecorationManagement()?.onDidUpdateDecoration(...args) ?? disposedDisposable
11381143
}
11391144
decorationForId(...args) {
1140-
return this.getDecorationManagement()?.decorationForId(...args) ?? {}
1145+
return this.getDecorationManagement()?.decorationForId(...args) ?? destoryedDecorationMock
11411146
}
11421147
decorationsForScreenRowRange(...args) {
1143-
return this.getDecorationManagement()?.decorationsForScreenRowRange(...args) ?? {}
1148+
return this.getDecorationManagement()?.decorationsForScreenRowRange(...args) ?? destoryedDecorationMock
11441149
}
11451150
decorationsByTypeThenRows() {
1146-
return this.getDecorationManagement()?.decorationsByTypeThenRows() ?? {}
1151+
return this.getDecorationManagement()?.decorationsByTypeThenRows() ?? destoryedDecorationMock
11471152
}
11481153
decorateMarker(...args) {
11491154
return this.getDecorationManagement()?.decorateMarker(...args)

0 commit comments

Comments
 (0)