Skip to content

Commit

Permalink
fix: memoize this.DecorationManagement
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 16, 2021
1 parent c5ac30c commit 5d4c1dc
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions lib/minimap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1066,20 +1066,23 @@ export default class Minimap {
* @return {DecorationManagement}
*/
getDecorationManagement () {
return this.minimapElement.DecorationManagement
if (this.DecorationManagement === undefined) {
this.DecorationManagement = this.minimapElement.DecorationManagement
}
return this.DecorationManagement
}

// Decoration API duplicated for backward compatibility in the service
getDecorations () { return this.minimapElement.DecorationManagement.getDecorations() }
onDidAddDecoration (...args) { return this.minimapElement.DecorationManagement.onDidAddDecoration(...args) }
onDidRemoveDecoration (...args) { return this.minimapElement.DecorationManagement.onDidRemoveDecoration(...args) }
onDidChangeDecorationRange (...args) { return this.minimapElement.DecorationManagement.onDidChangeDecorationRange(...args) }
onDidUpdateDecoration (...args) { return this.minimapElement.DecorationManagement.onDidUpdateDecoration(...args) }
decorationForId (...args) { return this.minimapElement.DecorationManagement.decorationForId(...args) }
decorationsForScreenRowRange (...args) { return this.minimapElement.DecorationManagement.decorationsForScreenRowRange(...args) }
decorationsByTypeThenRows () { return this.minimapElement.DecorationManagement.decorationsByTypeThenRows() }
decorateMarker (...args) { return this.minimapElement.DecorationManagement.decorateMarker(...args) }
removeDecoration (...args) { return this.minimapElement.DecorationManagement.removeDecoration(...args) }
removeAllDecorationsForMarker (...args) { return this.minimapElement.DecorationManagement.removeAllDecorationsForMarker(...args) }
removeAllDecorations () { return this.minimapElement.DecorationManagement.removeAllDecorations() }
getDecorations () { return this.getDecorationManagement().getDecorations() }
onDidAddDecoration (...args) { return this.getDecorationManagement().onDidAddDecoration(...args) }
onDidRemoveDecoration (...args) { return this.getDecorationManagement().onDidRemoveDecoration(...args) }
onDidChangeDecorationRange (...args) { return this.getDecorationManagement().onDidChangeDecorationRange(...args) }
onDidUpdateDecoration (...args) { return this.getDecorationManagement().onDidUpdateDecoration(...args) }
decorationForId (...args) { return this.getDecorationManagement().decorationForId(...args) }
decorationsForScreenRowRange (...args) { return this.getDecorationManagement().decorationsForScreenRowRange(...args) }
decorationsByTypeThenRows () { return this.getDecorationManagement().decorationsByTypeThenRows() }
decorateMarker (...args) { return this.getDecorationManagement().decorateMarker(...args) }
removeDecoration (...args) { return this.getDecorationManagement().removeDecoration(...args) }
removeAllDecorationsForMarker (...args) { return this.getDecorationManagement().removeAllDecorationsForMarker(...args) }
removeAllDecorations () { return this.getDecorationManagement().removeAllDecorations() }
}

0 comments on commit 5d4c1dc

Please sign in to comment.