Skip to content

Commit 7d8e63c

Browse files
Make changes requested by @aeisenberg
Co-authored by: Marc Jaramillo mnj.webdeveloper@gmail.com Co-authored by: Musab Guma'a mgsium@github.com
1 parent b22a869 commit 7d8e63c

1 file changed

Lines changed: 16 additions & 43 deletions

File tree

extensions/ql-vscode/src/databases-ui.ts

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -452,45 +452,26 @@ export class DatabaseUI extends DisposableObject {
452452
progress: ProgressCallback,
453453
token: CancellationToken
454454
): Promise<DatabaseItem | undefined> => {
455-
if (this.queryServer && await this.queryServer.cliServer.cliConstraints.supportsDatabaseUnbundle()) {
456-
return await promptImportInternetDatabase(
457-
this.databaseManager,
458-
this.storagePath,
459-
progress,
460-
token,
461-
this.queryServer.cliServer
462-
);
463-
} else {
464-
return await promptImportInternetDatabase(
465-
this.databaseManager,
466-
this.storagePath,
467-
progress,
468-
token
469-
);
470-
}
455+
return await promptImportInternetDatabase(
456+
this.databaseManager,
457+
this.storagePath,
458+
progress,
459+
token,
460+
this.queryServer?.cliServer
461+
);
471462
};
472463

473464
handleChooseDatabaseLgtm = async (
474465
progress: ProgressCallback,
475466
token: CancellationToken
476467
): Promise<DatabaseItem | undefined> => {
477-
478-
if (this.queryServer && await this.queryServer.cliServer.cliConstraints.supportsDatabaseUnbundle()) {
479-
return await promptImportLgtmDatabase(
480-
this.databaseManager,
481-
this.storagePath,
482-
progress,
483-
token,
484-
this.queryServer.cliServer
485-
);
486-
} else {
487-
return await promptImportLgtmDatabase(
488-
this.databaseManager,
489-
this.storagePath,
490-
progress,
491-
token
492-
);
493-
}
468+
return await promptImportLgtmDatabase(
469+
this.databaseManager,
470+
this.storagePath,
471+
progress,
472+
token,
473+
this.queryServer?.cliServer
474+
);
494475
};
495476

496477
async tryUpgradeCurrentDatabase(
@@ -591,10 +572,6 @@ export class DatabaseUI extends DisposableObject {
591572
token: CancellationToken,
592573
uri: Uri,
593574
): Promise<void> => {
594-
if (!this.queryServer) {
595-
throw new Error('Query server not started');
596-
}
597-
598575
try {
599576
// Assume user has selected an archive if the file has a .zip extension
600577
if (uri.path.endsWith('.zip')) {
@@ -604,7 +581,7 @@ export class DatabaseUI extends DisposableObject {
604581
this.storagePath,
605582
progress,
606583
token,
607-
this.queryServer.cliServer
584+
this.queryServer?.cliServer
608585
);
609586
} else {
610587
await this.setCurrentDatabase(progress, token, uri);
@@ -719,10 +696,6 @@ export class DatabaseUI extends DisposableObject {
719696
progress: ProgressCallback,
720697
token: CancellationToken,
721698
): Promise<DatabaseItem | undefined> {
722-
if (!this.queryServer) {
723-
throw new Error('Query server not started');
724-
}
725-
726699
const uri = await chooseDatabaseDir(byFolder);
727700
if (!uri) {
728701
return undefined;
@@ -741,7 +714,7 @@ export class DatabaseUI extends DisposableObject {
741714
this.storagePath,
742715
progress,
743716
token,
744-
this.queryServer.cliServer
717+
this.queryServer?.cliServer
745718
);
746719
}
747720
}

0 commit comments

Comments
 (0)