From 45d64860cdfebd5360076e33992994559878389e Mon Sep 17 00:00:00 2001 From: Tami Takamiya Date: Mon, 4 Mar 2024 07:43:55 -0500 Subject: [PATCH] Push disposals to context.subscriptions (#1112) Co-authored-by: Ganesh Nalawade --- src/extension.ts | 88 ++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 40 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 18ac0c0c3..70eca73a4 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -234,52 +234,60 @@ export async function activate(context: ExtensionContext): Promise { ); // register ansible meta data in the statusbar tooltip (client-server) - window.onDidChangeActiveTextEditor( - async (editor: vscode.TextEditor | undefined) => { + context.subscriptions.push( + window.onDidChangeActiveTextEditor( + async (editor: vscode.TextEditor | undefined) => { + await updateAnsibleStatusBar( + metaData, + lightSpeedManager, + pythonInterpreterManager + ); + if (editor) { + await lightSpeedManager.ansibleContentFeedback( + editor.document, + AnsibleContentUploadTrigger.TAB_CHANGE + ); + } + } + ) + ); + context.subscriptions.push( + workspace.onDidOpenTextDocument(async (document: vscode.TextDocument) => { await updateAnsibleStatusBar( metaData, lightSpeedManager, pythonInterpreterManager ); - if (editor) { - await lightSpeedManager.ansibleContentFeedback( - editor.document, - AnsibleContentUploadTrigger.TAB_CHANGE - ); - } - } + lightSpeedManager.ansibleContentFeedback( + document, + AnsibleContentUploadTrigger.FILE_OPEN + ); + }) + ); + context.subscriptions.push( + workspace.onDidCloseTextDocument(async (document: vscode.TextDocument) => { + await lightSpeedManager.ansibleContentFeedback( + document, + AnsibleContentUploadTrigger.FILE_CLOSE + ); + }) + ); + + context.subscriptions.push( + workspace.onDidChangeConfiguration(async () => { + await updateConfigurationChanges( + metaData, + pythonInterpreterManager, + extSettings, + lightSpeedManager + ); + await updateAnsibleStatusBar( + metaData, + lightSpeedManager, + pythonInterpreterManager + ); + }) ); - workspace.onDidOpenTextDocument(async (document: vscode.TextDocument) => { - await updateAnsibleStatusBar( - metaData, - lightSpeedManager, - pythonInterpreterManager - ); - lightSpeedManager.ansibleContentFeedback( - document, - AnsibleContentUploadTrigger.FILE_OPEN - ); - }); - workspace.onDidCloseTextDocument(async (document: vscode.TextDocument) => { - await lightSpeedManager.ansibleContentFeedback( - document, - AnsibleContentUploadTrigger.FILE_CLOSE - ); - }); - - workspace.onDidChangeConfiguration(async () => { - await updateConfigurationChanges( - metaData, - pythonInterpreterManager, - extSettings, - lightSpeedManager - ); - await updateAnsibleStatusBar( - metaData, - lightSpeedManager, - pythonInterpreterManager - ); - }); context.subscriptions.push( workspace.onDidChangeTextDocument((e: vscode.TextDocumentChangeEvent) => {