File tree Expand file tree Collapse file tree
base/browser/ui/selectBox
workbench/parts/debug/browser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,13 +40,14 @@ export class SelectBox extends Widget {
4040 return this . _onDidSelect . event ;
4141 }
4242
43- public setOptions ( options : string [ ] , selected ?: number ) : void {
43+ public setOptions ( options : string [ ] , selected ?: number , disabled ?: number ) : void {
4444 if ( ! this . options || ! arrays . equals ( this . options , options ) ) {
4545 this . options = options ;
4646
4747 this . selectElement . options . length = 0 ;
48+ let i = 0 ;
4849 this . options . forEach ( ( option ) => {
49- this . selectElement . add ( this . createOption ( option ) ) ;
50+ this . selectElement . add ( this . createOption ( option , disabled === i ++ ) ) ;
5051 } ) ;
5152 }
5253 this . select ( selected ) ;
@@ -91,10 +92,11 @@ export class SelectBox extends Widget {
9192 this . setOptions ( this . options , this . selected ) ;
9293 }
9394
94- private createOption ( value : string ) : HTMLOptionElement {
95+ private createOption ( value : string , disabled ?: boolean ) : HTMLOptionElement {
9596 let option = document . createElement ( 'option' ) ;
9697 option . value = value ;
9798 option . text = value ;
99+ option . disabled = disabled ;
98100
99101 return option ;
100102 }
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ const $ = dom.$;
2222export class StartDebugActionItem extends EventEmitter implements IActionItem {
2323
2424 private static ADD_CONFIGURATION = nls . localize ( 'addConfiguration' , "Add Configuration..." ) ;
25+ private static SEPARATOR = '─────────' ;
2526
2627 public actionRunner : IActionRunner ;
2728 private container : HTMLElement ;
@@ -132,8 +133,9 @@ export class StartDebugActionItem extends EventEmitter implements IActionItem {
132133 } else {
133134 this . setEnabled ( true ) ;
134135 const selected = options . indexOf ( this . debugService . getViewModel ( ) . selectedConfigurationName ) ;
136+ options . push ( StartDebugActionItem . SEPARATOR ) ;
135137 options . push ( StartDebugActionItem . ADD_CONFIGURATION ) ;
136- this . selectBox . setOptions ( options , selected ) ;
138+ this . selectBox . setOptions ( options , selected , options . length - 2 ) ;
137139 }
138140 }
139141}
You can’t perform that action at this time.
0 commit comments