@@ -135,8 +135,11 @@ export default class CanvasDrawer extends Mixin {
135135 const maxTokensInOneLine = this . maxTokensInOneLine
136136
137137 this . updateTokensLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , context , editor , editorElement , displayCodeHighlights , ignoreWhitespacesInTokens , maxTokensInOneLine )
138- this . updateBackDecorationsLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement )
139- this . updateFrontDecorationsLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement )
138+
139+ const decorations = this . minimap . decorationsByTypeThenRows ( firstRow , lastRow )
140+
141+ this . updateBackDecorationsLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
142+ this . updateFrontDecorationsLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
140143
141144 this . pendingChanges = [ ]
142145 this . pendingBackDecorationChanges = [ ]
@@ -226,9 +229,10 @@ export default class CanvasDrawer extends Mixin {
226229 * @param {number } canvasWidth this.tokensLayer.getSize().width
227230 * @param {number } canvasHeight this.tokensLayer.getSize().height
228231 * @param {TextEditorElement } editorElement this.minimap.getTextEditorElement()
232+ * @param {Array<Decoration> } decorations
229233 * @access private
230234 */
231- updateBackDecorationsLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement ) {
235+ updateBackDecorationsLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations ) {
232236 const intactRanges = computeIntactRanges ( firstRow , lastRow , this . pendingBackDecorationChanges , this . offscreenFirstRow , this . offscreenLastRow )
233237
234238 // NOTE: this method is the hot function of Minimap. Do not refactor. The code is inlined delibarately.
@@ -238,7 +242,7 @@ export default class CanvasDrawer extends Mixin {
238242 this . backLayer . clearCanvas ( )
239243
240244 if ( intactRanges . length === 0 ) {
241- this . drawBackDecorationsForLines ( firstRow , lastRow , 0 , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement )
245+ this . drawBackDecorationsForLines ( firstRow , lastRow , 0 , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
242246 } else {
243247 for ( let j = 0 , len = intactRanges . length ; j < len ; j ++ ) {
244248 const intact = intactRanges [ j ]
@@ -254,12 +258,12 @@ export default class CanvasDrawer extends Mixin {
254258 for ( let i = 0 , len = intactRanges . length ; i < len ; i ++ ) {
255259 const range = intactRanges [ i ]
256260
257- this . drawBackDecorationsForLines ( currentRow , range . start , currentRow - firstRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement )
261+ this . drawBackDecorationsForLines ( currentRow , range . start , currentRow - firstRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
258262
259263 currentRow = range . end
260264 }
261265 if ( currentRow <= lastRow ) {
262- this . drawBackDecorationsForLines ( currentRow , lastRow , currentRow - firstRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement )
266+ this . drawBackDecorationsForLines ( currentRow , lastRow , currentRow - firstRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
263267 }
264268 }
265269
@@ -280,9 +284,10 @@ export default class CanvasDrawer extends Mixin {
280284 * @param {number } canvasWidth this.tokensLayer.getSize().width
281285 * @param {number } canvasHeight this.tokensLayer.getSize().height
282286 * @param {TextEditorElement } editorElement this.minimap.getTextEditorElement()
287+ * @param {Array<Decoration> } decorations
283288 * @access private
284289 */
285- updateFrontDecorationsLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement ) {
290+ updateFrontDecorationsLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations ) {
286291 const intactRanges = computeIntactRanges ( firstRow , lastRow , this . pendingFrontDecorationChanges , this . offscreenFirstRow , this . offscreenLastRow )
287292
288293 // NOTE: this method is the hot function of Minimap. Do not refactor. The code is inlined delibarately.
@@ -292,7 +297,7 @@ export default class CanvasDrawer extends Mixin {
292297 this . frontLayer . clearCanvas ( )
293298
294299 if ( intactRanges . length === 0 ) {
295- this . drawFrontDecorationsForLines ( firstRow , lastRow , 0 , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement )
300+ this . drawFrontDecorationsForLines ( firstRow , lastRow , 0 , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
296301 } else {
297302 for ( let j = 0 , len = intactRanges . length ; j < len ; j ++ ) {
298303 const intact = intactRanges [ j ]
@@ -308,12 +313,12 @@ export default class CanvasDrawer extends Mixin {
308313 for ( let i = 0 , len = intactRanges . length ; i < len ; i ++ ) {
309314 const range = intactRanges [ i ]
310315
311- this . drawFrontDecorationsForLines ( currentRow , range . start , currentRow - firstRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement )
316+ this . drawFrontDecorationsForLines ( currentRow , range . start , currentRow - firstRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
312317
313318 currentRow = range . end
314319 }
315320 if ( currentRow <= lastRow ) {
316- this . drawFrontDecorationsForLines ( currentRow , lastRow , currentRow - firstRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement )
321+ this . drawFrontDecorationsForLines ( currentRow , lastRow , currentRow - firstRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
317322 }
318323 }
319324
@@ -474,12 +479,12 @@ export default class CanvasDrawer extends Mixin {
474479 * @param {number } canvasWidth this.tokensLayer.getSize().width
475480 * @param {number } canvasHeight this.tokensLayer.getSize().height
476481 * @param {TextEditorElement } editorElement this.minimap.getTextEditorElement()
482+ * @param {Array<Decoration> } decorations
477483 * @access private
478484 */
479- drawBackDecorationsForLines ( firstRow , lastRow , offsetRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement ) {
485+ drawBackDecorationsForLines ( firstRow , lastRow , offsetRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations ) {
480486 if ( firstRow > lastRow ) { return }
481487
482- const decorations = this . minimap . decorationsByTypeThenRows ( firstRow , lastRow )
483488 const renderData = {
484489 context : this . backLayer . context ,
485490 canvasWidth,
@@ -521,12 +526,12 @@ export default class CanvasDrawer extends Mixin {
521526 * @param {number } canvasWidth this.tokensLayer.getSize().width
522527 * @param {number } canvasHeight this.tokensLayer.getSize().height
523528 * @param {TextEditorElement } editorElement this.minimap.getTextEditorElement()
529+ * @param {Array<Decoration> } decorations
524530 * @access private
525531 */
526- drawFrontDecorationsForLines ( firstRow , lastRow , offsetRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement ) {
532+ drawFrontDecorationsForLines ( firstRow , lastRow , offsetRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations ) {
527533 if ( firstRow > lastRow ) { return }
528534
529- const decorations = this . minimap . decorationsByTypeThenRows ( firstRow , lastRow )
530535 const renderData = {
531536 context : this . frontLayer . context ,
532537 canvasWidth,
0 commit comments