File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
extensions/ql-vscode/src/mocks Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -157,12 +157,17 @@ export class MockGitHubApiServer extends DisposableObject {
157157 }
158158
159159 private setupConfigListener ( ) : void {
160- this . config . onDidChangeConfiguration ( ( ) => {
161- if ( this . config . mockServerEnabled && ! this . isListening ) {
162- this . startServer ( ) ;
163- } else if ( ! this . config . mockServerEnabled && this . isListening ) {
164- this . stopServer ( ) ;
165- }
166- } ) ;
160+ // The config "changes" from the default at startup, so we need to call onConfigChange() to ensure the server is
161+ // started if required.
162+ this . onConfigChange ( ) ;
163+ this . config . onDidChangeConfiguration ( ( ) => this . onConfigChange ( ) ) ;
164+ }
165+
166+ private onConfigChange ( ) : void {
167+ if ( this . config . mockServerEnabled && ! this . isListening ) {
168+ this . startServer ( ) ;
169+ } else if ( ! this . config . mockServerEnabled && this . isListening ) {
170+ this . stopServer ( ) ;
171+ }
167172 }
168173}
You can’t perform that action at this time.
0 commit comments