@@ -172,7 +172,7 @@ export class FortranLintingProvider {
172172 private pathCache = new Map < string , GlobPaths > ( ) ;
173173 private settings : LinterSettings ;
174174 private linter : GNULinter | GNUModernLinter | IntelLinter | NAGLinter ;
175- private disposables : vscode . Disposable [ ] ;
175+ private subscriptions : vscode . Disposable [ ] = [ ] ;
176176
177177 public provideCodeActions (
178178 document : vscode . TextDocument ,
@@ -183,14 +183,12 @@ export class FortranLintingProvider {
183183 return ;
184184 }
185185
186- public async activate ( context : vscode . ExtensionContext ) {
186+ public async activate ( ) : Promise < vscode . Disposable [ ] > {
187187 // Register Linter commands
188- context . subscriptions . push (
189- vscode . commands . registerCommand ( RescanLint , this . rescanLinter , this )
190- ) ;
191- context . subscriptions . push ( vscode . commands . registerCommand ( InitLint , this . initialize , this ) ) ;
192- context . subscriptions . push ( vscode . commands . registerCommand ( CleanLintFiles , this . clean , this ) ) ;
193- context . subscriptions . push (
188+ this . subscriptions . push ( vscode . commands . registerCommand ( RescanLint , this . rescanLinter , this ) ) ;
189+ this . subscriptions . push ( vscode . commands . registerCommand ( InitLint , this . initialize , this ) ) ;
190+ this . subscriptions . push ( vscode . commands . registerCommand ( CleanLintFiles , this . clean , this ) ) ;
191+ this . subscriptions . push (
194192 vscode . commands . registerCommand (
195193 CleanLintDiagnostics ,
196194 ( ) => {
@@ -199,7 +197,7 @@ export class FortranLintingProvider {
199197 this
200198 )
201199 ) ;
202- context . subscriptions . push (
200+ this . subscriptions . push (
203201 vscode . commands . registerTextEditorCommand (
204202 BuildRun ,
205203 async ( textEditor : vscode . TextEditor , edit : vscode . TextEditorEdit , ...args : any [ ] ) => {
@@ -208,7 +206,7 @@ export class FortranLintingProvider {
208206 this
209207 )
210208 ) ;
211- context . subscriptions . push (
209+ this . subscriptions . push (
212210 vscode . commands . registerTextEditorCommand (
213211 BuildDebug ,
214212 async ( textEditor : vscode . TextEditor , edit : vscode . TextEditorEdit , ...args : any [ ] ) => {
@@ -218,31 +216,33 @@ export class FortranLintingProvider {
218216 )
219217 ) ;
220218
221- vscode . workspace . onDidOpenTextDocument ( this . doLint , this , this . disposables ) ;
219+ vscode . workspace . onDidOpenTextDocument ( this . doLint , this , this . subscriptions ) ;
222220 vscode . workspace . onDidCloseTextDocument (
223221 doc => {
224222 this . fortranDiagnostics . delete ( doc . uri ) ;
225223 } ,
226224 this ,
227- this . disposables
225+ this . subscriptions
228226 ) ;
229227
230- vscode . workspace . onDidSaveTextDocument ( this . doLint , this , this . disposables ) ;
228+ vscode . workspace . onDidSaveTextDocument ( this . doLint , this , this . subscriptions ) ;
231229 // Run the linter for all open documents i.e. docs loaded in memory
232230 vscode . workspace . textDocuments . forEach ( this . doLint , this ) ;
233231
234232 // Update settings on Configuration change
235233 vscode . workspace . onDidChangeConfiguration ( e => {
236234 this . settings . update ( e ) ;
237- } , this . disposables ) ;
235+ } , this . subscriptions ) ;
238236
239237 if ( this . settings . initialize ) this . initialize ( ) ;
238+
239+ return this . subscriptions ;
240240 }
241241
242242 public dispose ( ) : void {
243243 this . fortranDiagnostics . clear ( ) ;
244244 this . fortranDiagnostics . dispose ( ) ;
245- this . disposables . forEach ( d => d . dispose ( ) ) ;
245+ this . subscriptions . forEach ( d => d . dispose ( ) ) ;
246246 }
247247
248248 /**
0 commit comments