@@ -16,7 +16,6 @@ import {
1616 ThemeIcon ,
1717 ThemeColor ,
1818 workspace ,
19- ProgressLocation ,
2019} from "vscode" ;
2120import { pathExists , stat , readdir , remove } from "fs-extra" ;
2221
@@ -25,13 +24,9 @@ import type {
2524 DatabaseItem ,
2625 DatabaseManager ,
2726} from "./local-databases" ;
28- import type {
29- ProgressCallback ,
30- ProgressContext ,
31- } from "../common/vscode/progress" ;
27+ import type { ProgressCallback } from "../common/vscode/progress" ;
3228import {
3329 UserCancellationException ,
34- withInheritedProgress ,
3530 withProgress ,
3631} from "../common/vscode/progress" ;
3732import {
@@ -332,10 +327,9 @@ export class DatabaseUI extends DisposableObject {
332327
333328 private async chooseDatabaseFolder (
334329 progress : ProgressCallback ,
335- token : CancellationToken ,
336330 ) : Promise < void > {
337331 try {
338- await this . chooseAndSetDatabase ( true , { progress, token } ) ;
332+ await this . chooseAndSetDatabase ( true , progress ) ;
339333 } catch ( e ) {
340334 void showAndLogExceptionWithTelemetry (
341335 this . app . logger ,
@@ -349,8 +343,8 @@ export class DatabaseUI extends DisposableObject {
349343
350344 private async handleChooseDatabaseFolder ( ) : Promise < void > {
351345 return withProgress (
352- async ( progress , token ) => {
353- await this . chooseDatabaseFolder ( progress , token ) ;
346+ async ( progress ) => {
347+ await this . chooseDatabaseFolder ( progress ) ;
354348 } ,
355349 {
356350 title : "Adding database from folder" ,
@@ -360,8 +354,8 @@ export class DatabaseUI extends DisposableObject {
360354
361355 private async handleChooseDatabaseFolderFromPalette ( ) : Promise < void > {
362356 return withProgress (
363- async ( progress , token ) => {
364- await this . chooseDatabaseFolder ( progress , token ) ;
357+ async ( progress ) => {
358+ await this . chooseDatabaseFolder ( progress ) ;
365359 } ,
366360 {
367361 title : "Choose a Database from a Folder" ,
@@ -502,10 +496,9 @@ export class DatabaseUI extends DisposableObject {
502496
503497 private async chooseDatabaseArchive (
504498 progress : ProgressCallback ,
505- token : CancellationToken ,
506499 ) : Promise < void > {
507500 try {
508- await this . chooseAndSetDatabase ( false , { progress, token } ) ;
501+ await this . chooseAndSetDatabase ( false , progress ) ;
509502 } catch ( e : unknown ) {
510503 void showAndLogExceptionWithTelemetry (
511504 this . app . logger ,
@@ -519,8 +512,8 @@ export class DatabaseUI extends DisposableObject {
519512
520513 private async handleChooseDatabaseArchive ( ) : Promise < void > {
521514 return withProgress (
522- async ( progress , token ) => {
523- await this . chooseDatabaseArchive ( progress , token ) ;
515+ async ( progress ) => {
516+ await this . chooseDatabaseArchive ( progress ) ;
524517 } ,
525518 {
526519 title : "Adding database from archive" ,
@@ -530,8 +523,8 @@ export class DatabaseUI extends DisposableObject {
530523
531524 private async handleChooseDatabaseArchiveFromPalette ( ) : Promise < void > {
532525 return withProgress (
533- async ( progress , token ) => {
534- await this . chooseDatabaseArchive ( progress , token ) ;
526+ async ( progress ) => {
527+ await this . chooseDatabaseArchive ( progress ) ;
535528 } ,
536529 {
537530 title : "Choose a Database from an Archive" ,
@@ -851,9 +844,8 @@ export class DatabaseUI extends DisposableObject {
851844 */
852845 public async getDatabaseItem (
853846 progress : ProgressCallback ,
854- token : CancellationToken ,
855847 ) : Promise < DatabaseItem | undefined > {
856- return await this . getDatabaseItemInternal ( { progress, token } ) ;
848+ return await this . getDatabaseItemInternal ( progress ) ;
857849 }
858850
859851 /**
@@ -866,10 +858,10 @@ export class DatabaseUI extends DisposableObject {
866858 * notification if it tries to perform any long-running operations.
867859 */
868860 private async getDatabaseItemInternal (
869- progressContext : ProgressContext | undefined ,
861+ progress : ProgressCallback | undefined ,
870862 ) : Promise < DatabaseItem | undefined > {
871863 if ( this . databaseManager . currentDatabaseItem === undefined ) {
872- progressContext ?. progress ( {
864+ progress ?. ( {
873865 maxStep : 2 ,
874866 step : 1 ,
875867 message : "Choosing database" ,
@@ -996,41 +988,31 @@ export class DatabaseUI extends DisposableObject {
996988 */
997989 private async chooseAndSetDatabase (
998990 byFolder : boolean ,
999- progress : ProgressContext | undefined ,
991+ progress : ProgressCallback ,
1000992 ) : Promise < DatabaseItem | undefined > {
1001993 const uri = await chooseDatabaseDir ( byFolder ) ;
1002994 if ( ! uri ) {
1003995 return undefined ;
1004996 }
1005997
1006- return await withInheritedProgress (
1007- progress ,
1008- async ( progress ) => {
1009- if ( byFolder ) {
1010- const fixedUri = await this . fixDbUri ( uri ) ;
1011- // we are selecting a database folder
1012- return await this . databaseManager . openDatabase ( fixedUri , {
1013- type : "folder" ,
1014- } ) ;
1015- } else {
1016- // we are selecting a database archive. Must unzip into a workspace-controlled area
1017- // before importing.
1018- return await importLocalDatabase (
1019- this . app . commands ,
1020- uri . toString ( true ) ,
1021- this . databaseManager ,
1022- this . storagePath ,
1023- progress ,
1024- this . queryServer . cliServer ,
1025- ) ;
1026- }
1027- } ,
1028- {
1029- location : ProgressLocation . Notification ,
1030- cancellable : true ,
1031- title : "Opening database" ,
1032- } ,
1033- ) ;
998+ if ( byFolder ) {
999+ const fixedUri = await this . fixDbUri ( uri ) ;
1000+ // we are selecting a database folder
1001+ return await this . databaseManager . openDatabase ( fixedUri , {
1002+ type : "folder" ,
1003+ } ) ;
1004+ } else {
1005+ // we are selecting a database archive. Must unzip into a workspace-controlled area
1006+ // before importing.
1007+ return await importLocalDatabase (
1008+ this . app . commands ,
1009+ uri . toString ( true ) ,
1010+ this . databaseManager ,
1011+ this . storagePath ,
1012+ progress ,
1013+ this . queryServer . cliServer ,
1014+ ) ;
1015+ }
10341016 }
10351017
10361018 /**
0 commit comments