File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -280,7 +280,7 @@ export class Options {
280
280
}
281
281
}
282
282
283
- private getApiKeyFromEditor ( ) : string {
283
+ public getApiKeyFromEditor ( ) : string {
284
284
return vscode . workspace . getConfiguration ( ) . get ( 'wakatime.apiKey' ) || '' ;
285
285
}
286
286
Original file line number Diff line number Diff line change @@ -369,7 +369,9 @@ export class WakaTime {
369
369
}
370
370
371
371
public async openDashboardWebsite ( ) : Promise < void > {
372
- const url = ( await this . options . getApiUrl ( true ) ) . replace ( '/api/v1' , '' ) . replace ( '://api.' , '://' ) ;
372
+ const url = ( await this . options . getApiUrl ( true ) )
373
+ . replace ( '/api/v1' , '' )
374
+ . replace ( '://api.' , '://' ) ;
373
375
vscode . env . openExternal ( vscode . Uri . parse ( url ) ) ;
374
376
}
375
377
@@ -567,7 +569,14 @@ export class WakaTime {
567
569
if ( this . isMetricsEnabled ) args . push ( '--metrics' ) ;
568
570
569
571
const apiKey = this . options . getApiKeyFromEnv ( ) ;
570
- if ( ! Utils . apiKeyInvalid ( apiKey ) ) args . push ( '--key' , Utils . quote ( apiKey ) ) ;
572
+ if ( ! Utils . apiKeyInvalid ( apiKey ) ) {
573
+ args . push ( '--key' , Utils . quote ( apiKey ) ) ;
574
+ } else {
575
+ const apiKeyFromSettings = this . options . getApiKeyFromEditor ( ) ;
576
+ if ( ! Utils . apiKeyInvalid ( apiKeyFromSettings ) ) {
577
+ args . push ( '--key' , Utils . quote ( apiKeyFromSettings ) ) ;
578
+ }
579
+ }
571
580
572
581
const apiUrl = await this . options . getApiUrl ( ) ;
573
582
if ( apiUrl ) args . push ( '--api-url' , Utils . quote ( apiUrl ) ) ;
You can’t perform that action at this time.
0 commit comments