File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,11 +50,14 @@ export class Expander
5050
5151 const val = this . definitions . get ( s ) ;
5252
53- for ( let k of this . definitions . keys ( ) )
53+ if ( val !== null )
5454 {
55- if ( val . indexOf ( k ) !== - 1 )
55+ for ( let k of this . definitions . keys ( ) )
5656 {
57- visit ( k ) ;
57+ if ( val . indexOf ( k ) !== - 1 )
58+ {
59+ visit ( k ) ;
60+ }
5861 }
5962 }
6063
Original file line number Diff line number Diff line change @@ -201,11 +201,17 @@ class Extension
201201 private getState < T > (
202202 key : string ,
203203 legal :( val :T ) => boolean ,
204- otherwise :( key :string ) => T )
204+ otherwise :( key :string ) => T ,
205+ valid :( ) => boolean = ( ) => true )
205206 {
207+ if ( ! valid ( ) )
208+ {
209+ return null ;
210+ }
211+
206212 let val = this . context . workspaceState . get < T > ( key ) ;
207213
208- if ( ! val || ! legal ( val ) )
214+ if ( ! val || ! legal ( val ) )
209215 {
210216 val = otherwise ( key ) ;
211217 this . context . workspaceState . update ( key , val ) ;
@@ -233,9 +239,11 @@ class Extension
233239 {
234240 return this . getState < string > (
235241 "debugConfig" ,
236- ( val :string ) => true ,
237- ( key :string ) => this . config . debugConfigurations . length > 0 ? this . config . debugConfigurations [ 0 ] . name : null
242+ ( val :string ) => this . config . debugConfigurations . some ( ( t ) => t . name == val ) ,
243+ ( key :string ) => this . config . debugConfigurations [ 0 ] . name ,
244+ ( ) => this . config . debugConfigurations . length > 0
238245 ) ;
246+
239247 }
240248
241249 set debugConfigName ( config : string )
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export class StatusBar
4646 this . killStatusItem . text = "$(x)" ;
4747 }
4848
49- public forallItems ( f : ( item :vscode . StatusBarItem ) => void )
49+ public forAllItems ( f : ( item :vscode . StatusBarItem ) => void )
5050 {
5151 f ( this . buildStatusItem ) ;
5252 f ( this . buildConfigStatusItem ) ;
@@ -58,24 +58,29 @@ export class StatusBar
5858
5959 public dispose ( )
6060 {
61- this . forallItems ( i => i . dispose ( ) ) ;
62- }
63-
64- public show ( )
65- {
66- this . forallItems ( i => i . show ( ) ) ;
61+ this . forAllItems ( i => i . dispose ( ) ) ;
6762 }
6863
6964 public hide ( )
7065 {
71- this . forallItems ( i => i . hide ( ) ) ;
66+ this . forAllItems ( i => i . hide ( ) ) ;
7267 }
7368
7469 public update ( buildConfig : string , debugConfig :string )
7570 {
7671 this . buildConfigStatusItem . text = buildConfig ;
7772 this . debugConfigStatusItem . text = debugConfig ;
7873
79- this . show ( ) ;
74+ this . forAllItems ( ( i ) =>
75+ {
76+ if ( debugConfig === null && ( i === this . debugStatusItem || i === this . runStatusItem || i === this . debugConfigStatusItem ) )
77+ {
78+ i . hide ( ) ;
79+ }
80+ else
81+ {
82+ i . show ( ) ;
83+ }
84+ } ) ;
8085 }
8186}
You can’t perform that action at this time.
0 commit comments