88import { LanguageService } from "./LanguageService" ;
99import * as path from "path" ;
1010import { getUrls } from "./constants" ;
11+ import { isBlank } from "./utils/pawsqlUtils" ;
1112
1213// Previous classes remain unchanged...
1314class WorkspaceManagerItem extends vscode . TreeItem {
@@ -350,7 +351,7 @@ export class PawSQLTreeProvider
350351 try {
351352 // Reset all validation states first
352353 this . isConfigValid = false ;
353- if ( ! backendUrl || ! frontendUrl || ! apiKey ) {
354+ if ( isBlank ( backendUrl ) || isBlank ( frontendUrl ) || isBlank ( apiKey ) ) {
354355 this . isConfigValid = false ;
355356 vscode . commands . executeCommand ( "setContext" , "isConfigured" , false ) ;
356357 this . workspaces = [ ] ;
@@ -441,14 +442,14 @@ export class PawSQLTreeProvider
441442 // Reset all validation states first
442443 this . isConfigValid = false ;
443444
444- if ( ! backendUrl || ! frontendUrl || ! apiKey ) {
445+ if ( isBlank ( backendUrl ) || isBlank ( frontendUrl ) || isBlank ( apiKey ) ) {
445446 this . isConfigValid = false ;
446447 vscode . commands . executeCommand ( "setContext" , "isConfigured" , false ) ;
447448 this . workspaces = [ ] ;
448449 return false ;
449450 }
450451
451- const backendResult = await validateBackend ( backendUrl ) ;
452+ const backendResult = await validateBackend ( backendUrl ?? "" ) ;
452453 const isBackendConnected = backendResult . isAvailable ;
453454
454455 if ( ! isBackendConnected ) {
@@ -458,7 +459,7 @@ export class PawSQLTreeProvider
458459 return false ;
459460 }
460461
461- const frontendReuslt = await validateFrontend ( frontendUrl ) ;
462+ const frontendReuslt = await validateFrontend ( frontendUrl ?? "" ) ;
462463 const isFrontendConnected = frontendReuslt . isAvailable ;
463464
464465 if ( ! isFrontendConnected ) {
@@ -469,7 +470,7 @@ export class PawSQLTreeProvider
469470 return false ;
470471 }
471472
472- const isApikeyValid = await ApiService . validateUserKey ( apiKey ) ;
473+ const isApikeyValid = await ApiService . validateUserKey ( apiKey ?? "" ) ;
473474
474475 if ( ! isApikeyValid ) {
475476 this . isConfigValid = false ;
@@ -523,6 +524,10 @@ export class PawSQLTreeProvider
523524 const apiKey = config . get < string > ( "apiKey" ) ?? "" ;
524525 const frontendUrl = config . get < string > ( "frontendUrl" ) ?? "" ;
525526 const backendUrl = config . get < string > ( "backendUrl" ) ?? "" ;
527+ if ( isBlank ( backendUrl ) || isBlank ( frontendUrl ) || isBlank ( apiKey ) ) {
528+ return false ;
529+ }
530+
526531 let failedCommand = [ ] ;
527532 try {
528533 const [ backendResult , frontendResult , isApikeyValid ] = await Promise . all ( [
@@ -569,6 +574,16 @@ export class PawSQLTreeProvider
569574 public async validateConfigurationByKey ( key : string ) : Promise < void > {
570575 const config = vscode . workspace . getConfiguration ( "pawsql" ) ;
571576 const value = config . get < string > ( key ) ;
577+ if ( isBlank ( value ) ) {
578+ this . workspaces = [ ] ;
579+ this . isConfigValid = false ;
580+ vscode . commands . executeCommand (
581+ "setContext" ,
582+ "isConfigured" ,
583+ this . isConfigValid
584+ ) ;
585+ return ;
586+ }
572587 try {
573588 if ( key === "backendUrl" ) {
574589 // Validate backend connectivity
0 commit comments