@@ -233,7 +233,6 @@ export default class DecorationManagement {
233233
234234 const decorations = this . decorationsById . values ( )
235235 for ( const decoration of decorations ) {
236-
237236 const range = decoration . marker . getScreenRange ( )
238237 const type = decoration . getProperties ( ) . type
239238
@@ -340,57 +339,57 @@ export default class DecorationManagement {
340339
341340 if ( ! this . decorationMarkerDestroyedSubscriptions . has ( id ) ) {
342341 this . decorationMarkerDestroyedSubscriptions . set ( id ,
343- marker . onDidDestroy ( ( ) => {
344- this . removeAllDecorationsForMarker ( marker )
345- } ) )
342+ marker . onDidDestroy ( ( ) => {
343+ this . removeAllDecorationsForMarker ( marker )
344+ } ) )
346345 }
347346
348347 if ( ! this . decorationMarkerChangedSubscriptions . has ( id ) ) {
349348 this . decorationMarkerChangedSubscriptions . set ( id ,
350- marker . onDidChange ( ( event ) => {
351- const decorations = this . decorationsByMarkerId . get ( id )
352- const screenRange = marker . getScreenRange ( )
353-
354- this . invalidateDecorationForScreenRowsCache ( )
355-
356- if ( decorations !== undefined ) {
357- for ( let i = 0 , len = decorations . length ; i < len ; i ++ ) {
358- const decoration = decorations [ i ]
359- this . emitter . emit ( 'did-change-decoration' , {
360- marker : marker ,
361- decoration : decoration ,
362- event : event
363- } )
364- this . emitDecorationChanges ( decoration . type , decoration )
365-
366- decoration . screenRange = screenRange
349+ marker . onDidChange ( ( event ) => {
350+ const decorations = this . decorationsByMarkerId . get ( id )
351+ const screenRange = marker . getScreenRange ( )
352+
353+ this . invalidateDecorationForScreenRowsCache ( )
354+
355+ if ( decorations !== undefined ) {
356+ for ( let i = 0 , len = decorations . length ; i < len ; i ++ ) {
357+ const decoration = decorations [ i ]
358+ this . emitter . emit ( 'did-change-decoration' , {
359+ marker,
360+ decoration,
361+ event
362+ } )
363+ this . emitDecorationChanges ( decoration . type , decoration )
364+
365+ decoration . screenRange = screenRange
366+ }
367367 }
368- }
369- let oldStart = event . oldTailScreenPosition
370- let oldEnd = event . oldHeadScreenPosition
371- let newStart = event . newTailScreenPosition
372- let newEnd = event . newHeadScreenPosition
373-
374- if ( oldStart . row > oldEnd . row ) {
375- [ oldStart , oldEnd ] = [ oldEnd , oldStart ]
376- }
377- if ( newStart . row > newEnd . row ) {
378- [ newStart , newEnd ] = [ newEnd , newStart ]
379- }
380-
381- const rangesDiffs = this . computeRangesDiffs (
382- oldStart , oldEnd ,
383- newStart , newEnd
384- )
385-
386- for ( let i = 0 , len = rangesDiffs . length ; i < len ; i ++ ) {
387- const [ start , end ] = rangesDiffs [ i ]
388- this . emitRangeChanges ( type , {
389- start : start ,
390- end : end
391- } , 0 )
392- }
393- } ) )
368+ let oldStart = event . oldTailScreenPosition
369+ let oldEnd = event . oldHeadScreenPosition
370+ let newStart = event . newTailScreenPosition
371+ let newEnd = event . newHeadScreenPosition
372+
373+ if ( oldStart . row > oldEnd . row ) {
374+ [ oldStart , oldEnd ] = [ oldEnd , oldStart ]
375+ }
376+ if ( newStart . row > newEnd . row ) {
377+ [ newStart , newEnd ] = [ newEnd , newStart ]
378+ }
379+
380+ const rangesDiffs = this . computeRangesDiffs (
381+ oldStart , oldEnd ,
382+ newStart , newEnd
383+ )
384+
385+ for ( let i = 0 , len = rangesDiffs . length ; i < len ; i ++ ) {
386+ const [ start , end ] = rangesDiffs [ i ]
387+ this . emitRangeChanges ( type , {
388+ start,
389+ end
390+ } , 0 )
391+ }
392+ } ) )
394393 }
395394
396395 const decoration = new Decoration ( marker , this , decorationParams )
@@ -404,20 +403,20 @@ export default class DecorationManagement {
404403
405404 if ( ! this . decorationUpdatedSubscriptions . has ( decoration . id ) ) {
406405 this . decorationUpdatedSubscriptions . set ( decoration . id ,
407- decoration . onDidChangeProperties ( ( event ) => {
408- this . emitDecorationChanges ( type , decoration )
409- } ) )
406+ decoration . onDidChangeProperties ( ( event ) => {
407+ this . emitDecorationChanges ( type , decoration )
408+ } ) )
410409 }
411410
412411 this . decorationDestroyedSubscriptions . set ( decoration . id ,
413- decoration . onDidDestroy ( ( ) => {
414- this . removeDecoration ( decoration )
415- } ) )
412+ decoration . onDidDestroy ( ( ) => {
413+ this . removeDecoration ( decoration )
414+ } ) )
416415
417416 this . emitDecorationChanges ( type , decoration )
418417 this . emitter . emit ( 'did-add-decoration' , {
419- marker : marker ,
420- decoration : decoration
418+ marker,
419+ decoration
421420 } )
422421
423422 return decoration
@@ -504,8 +503,8 @@ export default class DecorationManagement {
504503 const changeEvent = {
505504 start : startScreenRow ,
506505 end : endScreenRow ,
507- screenDelta : screenDelta ,
508- type : type
506+ screenDelta,
507+ type
509508 }
510509
511510 this . emitter . emit ( 'did-change-decoration-range' , changeEvent )
@@ -545,8 +544,8 @@ export default class DecorationManagement {
545544 decorations . splice ( index , 1 )
546545
547546 this . emitter . emit ( 'did-remove-decoration' , {
548- marker : marker ,
549- decoration : decoration
547+ marker,
548+ decoration
550549 } )
551550
552551 if ( decorations . length === 0 ) {
@@ -575,8 +574,8 @@ export default class DecorationManagement {
575574 this . emitDecorationChanges ( decoration . getProperties ( ) . type , decoration )
576575 }
577576 this . emitter . emit ( 'did-remove-decoration' , {
578- marker : marker ,
579- decoration : decoration
577+ marker,
578+ decoration
580579 } )
581580 }
582581
0 commit comments