export async function updateDiagnostics()

in vscode-extension/src/diagnostic.ts [18:51]


export async function updateDiagnostics(
    documentUri: vscode.Uri,
    diagcCollection: vscode.DiagnosticCollection,
    powershell: PowershellProcess,
    azureRmVersion: string,
    log: Logger): Promise<void> {
    if (documentUri) {
        //exec the migration powershell command
        let planResult: string;
        try {
            log.write(`Start analyzing ${documentUri.fsPath}`);
            planResult = await powershell.getUpgradePlanToLatest(documentUri.fsPath, azureRmVersion);
            log.write(`Node-Powershell Success. -- ${documentUri.fsPath}`);
        }
        catch (e) {
            log.writeError(`Error: Node-Powershell failed.` + e.message);
        }

        //update the content of diagnostic
        if (planResult) {
            const diagnostics: vscode.Diagnostic[] = formatPlanstToDiag(planResult, log);
            diagcCollection.set(documentUri, diagnostics);
            log.write(`Diagnostics Number : ${diagnostics.length}  `);
        }
        else {
            log.write(`This file is not need to be migrated.`);
        }


    } else {
        diagcCollection.clear();
    }

}