@@ -23,9 +23,9 @@ import { MESSAGE } from 'triple-beam';
2323import { ExecuteCommandRequest , LanguageClient , Middleware } from 'vscode-languageclient/node' ;
2424import winston , { format , transports } from 'winston' ;
2525import Transport from 'winston-transport' ;
26+ import { ExtensionState } from './ExtensionState' ;
2627import { ALSClientFeatures } from './alsClientFeatures' ;
2728import { alsCommandExecutor } from './alsExecuteCommand' ;
28- import { ContextClients } from './clients' ;
2929import { registerCommands } from './commands' ;
3030import { initializeDebugging } from './debugConfigProvider' ;
3131import { initializeTestView } from './gnattest' ;
@@ -37,7 +37,13 @@ import {
3737} from './helpers' ;
3838
3939const ADA_CONTEXT = 'ADA_PROJECT_CONTEXT' ;
40- export let contextClients : ContextClients ;
40+
41+ /**
42+ * A global object encapsulating extension state. This includes the Ada and GPR
43+ * LSP clients and other state used to provide tasks, commands and other
44+ * functionality.
45+ */
46+ export let adaExtState : ExtensionState ;
4147
4248/**
4349 * The `vscode.OutputChannel` that hosts messages from the extension. This is
@@ -134,35 +140,34 @@ async function activateExtension(context: vscode.ExtensionContext) {
134140 }
135141
136142 // Create the Ada and GPR clients.
137- contextClients = new ContextClients ( context ) ;
143+ adaExtState = new ExtensionState ( context ) ;
144+ context . subscriptions . push ( adaExtState ) ;
138145
139146 const alsMiddleware : Middleware = {
140- executeCommand : alsCommandExecutor ( contextClients . adaClient ) ,
147+ executeCommand : alsCommandExecutor ( adaExtState . adaClient ) ,
141148 } ;
142- contextClients . adaClient . clientOptions . middleware = alsMiddleware ;
143- contextClients . adaClient . registerFeature ( new ALSClientFeatures ( ) ) ;
144-
145- contextClients . start ( ) ;
149+ adaExtState . adaClient . clientOptions . middleware = alsMiddleware ;
150+ adaExtState . adaClient . registerFeature ( new ALSClientFeatures ( ) ) ;
146151
147- context . subscriptions . push ( contextClients ) ;
152+ adaExtState . start ( ) ;
148153
149154 context . subscriptions . push (
150- vscode . workspace . onDidChangeConfiguration ( contextClients . configChanged )
155+ vscode . workspace . onDidChangeConfiguration ( adaExtState . configChanged )
151156 ) ;
152157
153- await Promise . all ( [ contextClients . adaClient . onReady ( ) , contextClients . gprClient . onReady ( ) ] ) ;
158+ await Promise . all ( [ adaExtState . adaClient . onReady ( ) , adaExtState . gprClient . onReady ( ) ] ) ;
154159
155160 await vscode . commands . executeCommand ( 'setContext' , ADA_CONTEXT , true ) ;
156161
157- await checkSrcDirectories ( contextClients . adaClient ) ;
162+ await checkSrcDirectories ( adaExtState . adaClient ) ;
158163
159- await initializeTestView ( context , contextClients ) ;
164+ await initializeTestView ( context , adaExtState ) ;
160165
161- await Promise . all ( [ contextClients . adaClient . onReady ( ) , contextClients . gprClient . onReady ( ) ] ) ;
166+ await Promise . all ( [ adaExtState . adaClient . onReady ( ) , adaExtState . gprClient . onReady ( ) ] ) ;
162167
163168 initializeDebugging ( context ) ;
164169
165- registerCommands ( context , contextClients ) ;
170+ registerCommands ( context , adaExtState ) ;
166171}
167172
168173function setUpLogging ( ) {
0 commit comments