function registerHandlers()

in vscode-extension/src/extension.ts [89:111]


function registerHandlers(
    context: vscode.ExtensionContext,
    diagcCollection: vscode.DiagnosticCollection,
    azureRmVersion: string,
    log: Logger): void {
    if (vscode.window.activeTextEditor) {
        updateDiagnostics(vscode.window.activeTextEditor.document.uri, diagcCollection, powershell, azureRmVersion, log);
    }

    //do the analysis when the file is opened
    context.subscriptions.push(vscode.workspace.onDidOpenTextDocument(editor => {
        if (editor && editor.languageId == "powershell") {
            updateDiagnostics(editor.uri, diagcCollection, powershell, azureRmVersion, log);
        }
    }));

    //do the analysis when the file is saved
    context.subscriptions.push(vscode.workspace.onDidSaveTextDocument(editor => {
        if (editor && editor.languageId == "powershell") {
            updateDiagnostics(editor.uri, diagcCollection, powershell, azureRmVersion, log);
        }
    }));
}