@@ -28,7 +28,7 @@ export class DbConfigStore extends DisposableObject {
2828 private configErrors : DbConfigValidationError [ ] ;
2929 private configWatcher : chokidar . FSWatcher | undefined ;
3030
31- public constructor ( app : App ) {
31+ public constructor ( private readonly app : App ) {
3232 super ( ) ;
3333
3434 const storagePath = app . workspaceStoragePath || app . globalStoragePath ;
@@ -147,13 +147,27 @@ export class DbConfigStore extends DisposableObject {
147147 message : `Failed to read config file: ${ this . configPath } ` ,
148148 } ,
149149 ] ;
150+ await this . app . executeCommand (
151+ "setContext" ,
152+ "codeQLDatabasesExperimental.configError" ,
153+ true ,
154+ ) ;
150155 }
151156
152157 if ( newConfig ) {
153158 this . configErrors = this . configValidator . validate ( newConfig ) ;
154159 }
155160
156- this . config = this . configErrors . length === 0 ? newConfig : undefined ;
161+ if ( this . configErrors . length === 0 ) {
162+ this . config = newConfig ;
163+ await this . app . executeCommand (
164+ "setContext" ,
165+ "codeQLDatabasesExperimental.configError" ,
166+ false ,
167+ ) ;
168+ } else {
169+ this . config = undefined ;
170+ }
157171 }
158172
159173 private readConfigSync ( ) : void {
@@ -167,14 +181,27 @@ export class DbConfigStore extends DisposableObject {
167181 message : `Failed to read config file: ${ this . configPath } ` ,
168182 } ,
169183 ] ;
184+ void this . app . executeCommand (
185+ "setContext" ,
186+ "codeQLDatabasesExperimental.configError" ,
187+ true ,
188+ ) ;
170189 }
171190
172191 if ( newConfig ) {
173192 this . configErrors = this . configValidator . validate ( newConfig ) ;
174193 }
175194
176- this . config = this . configErrors . length === 0 ? newConfig : undefined ;
177-
195+ if ( this . configErrors . length === 0 ) {
196+ this . config = newConfig ;
197+ void this . app . executeCommand (
198+ "setContext" ,
199+ "codeQLDatabasesExperimental.configError" ,
200+ false ,
201+ ) ;
202+ } else {
203+ this . config = undefined ;
204+ }
178205 this . onDidChangeConfigEventEmitter . fire ( ) ;
179206 }
180207
0 commit comments