Skip to content

Commit 5d4c1dc

Browse files
committed
fix: memoize this.DecorationManagement
1 parent c5ac30c commit 5d4c1dc

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

lib/minimap.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,20 +1066,23 @@ export default class Minimap {
10661066
* @return {DecorationManagement}
10671067
*/
10681068
getDecorationManagement () {
1069-
return this.minimapElement.DecorationManagement
1069+
if (this.DecorationManagement === undefined) {
1070+
this.DecorationManagement = this.minimapElement.DecorationManagement
1071+
}
1072+
return this.DecorationManagement
10701073
}
10711074

10721075
// Decoration API duplicated for backward compatibility in the service
1073-
getDecorations () { return this.minimapElement.DecorationManagement.getDecorations() }
1074-
onDidAddDecoration (...args) { return this.minimapElement.DecorationManagement.onDidAddDecoration(...args) }
1075-
onDidRemoveDecoration (...args) { return this.minimapElement.DecorationManagement.onDidRemoveDecoration(...args) }
1076-
onDidChangeDecorationRange (...args) { return this.minimapElement.DecorationManagement.onDidChangeDecorationRange(...args) }
1077-
onDidUpdateDecoration (...args) { return this.minimapElement.DecorationManagement.onDidUpdateDecoration(...args) }
1078-
decorationForId (...args) { return this.minimapElement.DecorationManagement.decorationForId(...args) }
1079-
decorationsForScreenRowRange (...args) { return this.minimapElement.DecorationManagement.decorationsForScreenRowRange(...args) }
1080-
decorationsByTypeThenRows () { return this.minimapElement.DecorationManagement.decorationsByTypeThenRows() }
1081-
decorateMarker (...args) { return this.minimapElement.DecorationManagement.decorateMarker(...args) }
1082-
removeDecoration (...args) { return this.minimapElement.DecorationManagement.removeDecoration(...args) }
1083-
removeAllDecorationsForMarker (...args) { return this.minimapElement.DecorationManagement.removeAllDecorationsForMarker(...args) }
1084-
removeAllDecorations () { return this.minimapElement.DecorationManagement.removeAllDecorations() }
1076+
getDecorations () { return this.getDecorationManagement().getDecorations() }
1077+
onDidAddDecoration (...args) { return this.getDecorationManagement().onDidAddDecoration(...args) }
1078+
onDidRemoveDecoration (...args) { return this.getDecorationManagement().onDidRemoveDecoration(...args) }
1079+
onDidChangeDecorationRange (...args) { return this.getDecorationManagement().onDidChangeDecorationRange(...args) }
1080+
onDidUpdateDecoration (...args) { return this.getDecorationManagement().onDidUpdateDecoration(...args) }
1081+
decorationForId (...args) { return this.getDecorationManagement().decorationForId(...args) }
1082+
decorationsForScreenRowRange (...args) { return this.getDecorationManagement().decorationsForScreenRowRange(...args) }
1083+
decorationsByTypeThenRows () { return this.getDecorationManagement().decorationsByTypeThenRows() }
1084+
decorateMarker (...args) { return this.getDecorationManagement().decorateMarker(...args) }
1085+
removeDecoration (...args) { return this.getDecorationManagement().removeDecoration(...args) }
1086+
removeAllDecorationsForMarker (...args) { return this.getDecorationManagement().removeAllDecorationsForMarker(...args) }
1087+
removeAllDecorations () { return this.getDecorationManagement().removeAllDecorations() }
10851088
}

0 commit comments

Comments
 (0)