@@ -115,10 +115,7 @@ import {
115115 QueryServerCommands ,
116116 TestUICommands ,
117117} from "./common/commands" ;
118- import {
119- getLocalQueryCommands ,
120- showResultsForCompletedQuery ,
121- } from "./local-queries" ;
118+ import { LocalQueries } from "./local-queries" ;
122119import { getAstCfgCommands } from "./ast-cfg-commands" ;
123120import { getQueryEditorCommands } from "./query-editor" ;
124121import { App } from "./common/app" ;
@@ -712,12 +709,6 @@ async function activateWithInstalledDistribution(
712709 void extLogger . log ( "Initializing query history manager." ) ;
713710 const queryHistoryConfigurationListener = new QueryHistoryConfigListener ( ) ;
714711 ctx . subscriptions . push ( queryHistoryConfigurationListener ) ;
715- const showResults = async ( item : CompletedLocalQueryInfo ) =>
716- showResultsForCompletedQuery (
717- localQueryResultsView ,
718- item ,
719- WebviewReveal . Forced ,
720- ) ;
721712 const queryStorageDir = join ( ctx . globalStorageUri . fsPath , "queries" ) ;
722713 await ensureDir ( queryStorageDir ) ;
723714
@@ -791,8 +782,10 @@ async function activateWithInstalledDistribution(
791782 ctx ,
792783 queryHistoryConfigurationListener ,
793784 labelProvider ,
794- async ( from : CompletedLocalQueryInfo , to : CompletedLocalQueryInfo ) =>
795- showResultsForComparison ( compareView , from , to ) ,
785+ async (
786+ from : CompletedLocalQueryInfo ,
787+ to : CompletedLocalQueryInfo ,
788+ ) : Promise < void > => showResultsForComparison ( compareView , from , to ) ,
796789 ) ;
797790
798791 ctx . subscriptions . push ( qhm ) ;
@@ -813,7 +806,8 @@ async function activateWithInstalledDistribution(
813806 cliServer ,
814807 queryServerLogger ,
815808 labelProvider ,
816- showResults ,
809+ async ( item : CompletedLocalQueryInfo ) =>
810+ localQueries . showResultsForCompletedQuery ( item , WebviewReveal . Forced ) ,
817811 ) ;
818812 ctx . subscriptions . push ( compareView ) ;
819813
@@ -849,6 +843,18 @@ async function activateWithInstalledDistribution(
849843 true ,
850844 ) ;
851845
846+ const localQueries = new LocalQueries (
847+ app ,
848+ qs ,
849+ qhm ,
850+ dbm ,
851+ cliServer ,
852+ databaseUI ,
853+ localQueryResultsView ,
854+ queryStorageDir ,
855+ ) ;
856+ ctx . subscriptions . push ( localQueries ) ;
857+
852858 void extLogger . log ( "Initializing QLTest interface." ) ;
853859 const testExplorerExtension = extensions . getExtension < TestHub > (
854860 testExplorerExtensionId ,
@@ -902,11 +908,7 @@ async function activateWithInstalledDistribution(
902908 ...databaseUI . getCommands ( ) ,
903909 ...dbModule . getCommands ( ) ,
904910 ...getAstCfgCommands ( {
905- queryRunner : qs ,
906- queryHistoryManager : qhm ,
907- databaseUI,
908- localQueryResultsView,
909- queryStorageDir,
911+ localQueries,
910912 astViewer,
911913 astTemplateProvider,
912914 cfgTemplateProvider,
@@ -926,16 +928,7 @@ async function activateWithInstalledDistribution(
926928 }
927929
928930 const queryServerCommands : QueryServerCommands = {
929- ...getLocalQueryCommands ( {
930- app,
931- queryRunner : qs ,
932- queryHistoryManager : qhm ,
933- databaseManager : dbm ,
934- cliServer,
935- databaseUI,
936- localQueryResultsView,
937- queryStorageDir,
938- } ) ,
931+ ...localQueries . getCommands ( ) ,
939932 } ;
940933
941934 for ( const [ commandName , command ] of Object . entries ( queryServerCommands ) ) {
0 commit comments