@@ -17,7 +17,12 @@ let reporter: TelemetryReporter;
17
17
let clientHandler : ClientHandler ;
18
18
const languageServerUpdater = new SingleInstanceTimeout ( ) ;
19
19
20
- export async function activate ( context : vscode . ExtensionContext ) : Promise < any > {
20
+ export interface TerraformExtension {
21
+ handler : ClientHandler ;
22
+ moduleCallers ;
23
+ }
24
+
25
+ export async function activate ( context : vscode . ExtensionContext ) : Promise < TerraformExtension > {
21
26
const manifest = context . extension . packageJSON ;
22
27
reporter = new TelemetryReporter ( context . extension . id , manifest . version , manifest . appInsightsKey ) ;
23
28
context . subscriptions . push ( reporter ) ;
@@ -122,6 +127,12 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
122
127
} ) ,
123
128
vscode . window . onDidChangeVisibleTextEditors ( async ( ) => {
124
129
const textEditor = getActiveTextEditor ( ) ;
130
+ if ( textEditor === undefined ) {
131
+ return ;
132
+ }
133
+ if ( textEditor . document === undefined ) {
134
+ return ;
135
+ }
125
136
await updateTerraformStatusBar ( textEditor . document . uri ) ;
126
137
} ) ,
127
138
vscode . window . registerTreeDataProvider ( 'terraform.modules' , new ModuleProvider ( context , clientHandler ) ) ,
@@ -137,7 +148,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
137
148
}
138
149
139
150
// export public API
140
- return { clientHandler, moduleCallers } ;
151
+ return { handler : clientHandler , moduleCallers } ;
141
152
}
142
153
143
154
export function deactivate ( ) : Promise < void > {
0 commit comments