@@ -28,6 +28,7 @@ interface ISelectListTemplateData {
2828 root : HTMLElement ;
2929 text : HTMLElement ;
3030 itemDescription : HTMLElement ;
31+ decorationRight : HTMLElement ;
3132 disposables : IDisposable [ ] ;
3233}
3334
@@ -42,6 +43,7 @@ class SelectListRenderer implements IListRenderer<ISelectOptionItem, ISelectList
4243 data . disposables = [ ] ;
4344 data . root = container ;
4445 data . text = dom . append ( container , $ ( '.option-text' ) ) ;
46+ data . decorationRight = dom . append ( container , $ ( '.option-decoration-right' ) ) ;
4547 data . itemDescription = dom . append ( container , $ ( '.option-text-description' ) ) ;
4648 dom . addClass ( data . itemDescription , 'visually-hidden' ) ;
4749
@@ -51,9 +53,11 @@ class SelectListRenderer implements IListRenderer<ISelectOptionItem, ISelectList
5153 renderElement ( element : ISelectOptionItem , index : number , templateData : ISelectListTemplateData ) : void {
5254 const data = < ISelectListTemplateData > templateData ;
5355 const text = ( < ISelectOptionItem > element ) . text ;
56+ const decorationRight = ( < ISelectOptionItem > element ) . decorationRight ;
5457 const isDisabled = ( < ISelectOptionItem > element ) . isDisabled ;
5558
5659 data . text . textContent = text ;
60+ data . decorationRight . innerText = ( ! ! decorationRight ? decorationRight : '' ) ;
5761
5862 if ( typeof element . description === 'string' ) {
5963 const itemDescriptionId = ( text . replace ( / / g, '_' ) . toLowerCase ( ) + '_description_' + data . root . id ) ;
@@ -687,14 +691,18 @@ export class SelectBoxList implements ISelectBoxDelegate, IListVirtualDelegate<I
687691
688692 if ( container && ! ! this . options ) {
689693 let longest = 0 ;
694+ let longestLength = 0 ;
690695
691- for ( let index = 0 ; index < this . options . length ; index ++ ) {
692- if ( this . options [ index ] . text . length > this . options [ longest ] . text . length ) {
696+ this . options . forEach ( ( option , index ) => {
697+ const len = option . text . length + ( ! ! option . decorationRight ? option . decorationRight . length : 0 ) ;
698+ if ( len > longestLength ) {
693699 longest = index ;
700+ longestLength = len ;
694701 }
695- }
702+ } ) ;
696703
697- container . innerHTML = this . options [ longest ] . text ;
704+
705+ container . innerHTML = this . options [ longest ] . text + ( ! ! this . options [ longest ] . decorationRight ? ( this . options [ longest ] . decorationRight + ' ' ) : '' ) ;
698706 elementWidth = dom . getTotalWidth ( container ) ;
699707 }
700708
@@ -770,11 +778,12 @@ export class SelectBoxList implements ISelectBoxDelegate, IListVirtualDelegate<I
770778 dom . EventHelper . stop ( e ) ;
771779
772780 // Check our mouse event is on an option (not scrollbar)
773- if ( ! e . toElement . classList . contains ( 'option-text ' ) ) {
781+ if ( ! ! e . toElement . classList . contains ( 'slider ' ) ) {
774782 return ;
775783 }
776784
777- const listRowElement = e . toElement . parentElement ;
785+ const listRowElement = e . toElement . closest ( '.monaco-list-row' ) ;
786+
778787 if ( ! listRowElement ) {
779788 return ;
780789 }
0 commit comments