@@ -133,7 +133,7 @@ import {
133133 getLocalQueryCommands ,
134134 showResultsForCompletedQuery ,
135135} from "./local-queries" ;
136- import { registerAstCfgCommands } from "./ast-cfg-commands" ;
136+ import { getAstCfgCommands } from "./ast-cfg-commands" ;
137137
138138/**
139139 * extension.ts
@@ -651,6 +651,15 @@ async function activateWithInstalledDistribution(
651651 ) ;
652652 const queryStorageDir = join ( ctx . globalStorageUri . fsPath , "queries" ) ;
653653 await ensureDir ( queryStorageDir ) ;
654+
655+ // Store contextual queries in a temporary folder so that they are removed
656+ // when the application closes. There is no need for the user to interact with them.
657+ const contextualQueryStorageDir = join (
658+ tmpDir . name ,
659+ "contextual-query-storage" ,
660+ ) ;
661+ await ensureDir ( contextualQueryStorageDir ) ;
662+
654663 const labelProvider = new HistoryItemLabelProvider (
655664 queryHistoryConfigurationListener ,
656665 ) ;
@@ -787,6 +796,17 @@ async function activateWithInstalledDistribution(
787796 ctx . subscriptions . push ( testUIService ) ;
788797 }
789798
799+ const astViewer = new AstViewer ( ) ;
800+ const astTemplateProvider = new TemplatePrintAstProvider (
801+ cliServer ,
802+ qs ,
803+ dbm ,
804+ contextualQueryStorageDir ,
805+ ) ;
806+ const cfgTemplateProvider = new TemplatePrintCfgProvider ( cliServer , dbm ) ;
807+
808+ ctx . subscriptions . push ( astViewer ) ;
809+
790810 void extLogger . log ( "Registering top-level command palette commands." ) ;
791811
792812 const allCommands : AllCommands = {
@@ -795,6 +815,16 @@ async function activateWithInstalledDistribution(
795815 ...variantAnalysisManager . getCommands ( ) ,
796816 ...databaseUI . getCommands ( ) ,
797817 ...dbModule . getCommands ( ) ,
818+ ...getAstCfgCommands ( {
819+ queryRunner : qs ,
820+ queryHistoryManager : qhm ,
821+ databaseUI,
822+ localQueryResultsView,
823+ queryStorageDir,
824+ astViewer,
825+ astTemplateProvider,
826+ cfgTemplateProvider,
827+ } ) ,
798828 } ;
799829
800830 for ( const [ commandName , command ] of Object . entries ( allCommands ) ) {
@@ -1057,13 +1087,6 @@ async function activateWithInstalledDistribution(
10571087 // Jump-to-definition and find-references
10581088 void extLogger . log ( "Registering jump-to-definition handlers." ) ;
10591089
1060- // Store contextual queries in a temporary folder so that they are removed
1061- // when the application closes. There is no need for the user to interact with them.
1062- const contextualQueryStorageDir = join (
1063- tmpDir . name ,
1064- "contextual-query-storage" ,
1065- ) ;
1066- await ensureDir ( contextualQueryStorageDir ) ;
10671090 languages . registerDefinitionProvider (
10681091 { scheme : zipArchiveScheme } ,
10691092 new TemplateQueryDefinitionProvider (
@@ -1084,28 +1107,6 @@ async function activateWithInstalledDistribution(
10841107 ) ,
10851108 ) ;
10861109
1087- const astViewer = new AstViewer ( ) ;
1088- const astTemplateProvider = new TemplatePrintAstProvider (
1089- cliServer ,
1090- qs ,
1091- dbm ,
1092- contextualQueryStorageDir ,
1093- ) ;
1094- const cfgTemplateProvider = new TemplatePrintCfgProvider ( cliServer , dbm ) ;
1095-
1096- ctx . subscriptions . push ( astViewer ) ;
1097-
1098- registerAstCfgCommands ( ctx , {
1099- queryRunner : qs ,
1100- queryHistoryManager : qhm ,
1101- databaseUI,
1102- localQueryResultsView,
1103- queryStorageDir,
1104- astViewer,
1105- astTemplateProvider,
1106- cfgTemplateProvider,
1107- } ) ;
1108-
11091110 const mockServer = new VSCodeMockGitHubApiServer ( ctx ) ;
11101111 ctx . subscriptions . push ( mockServer ) ;
11111112 ctx . subscriptions . push (
0 commit comments