How to use the botbuilder-lg.DiagnosticSeverity.Warning function in botbuilder-lg

To help you get started, we’ve selected a few botbuilder-lg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / botbuilder-tools / packages / LGvscodeExt / src / providers / diagnostics.ts View on Github external
let ignored = false;
                const funcName = extractFuncName(u.message);
                console.log(funcName);
                if (customFunctionList.includes(funcName)) {
                    ignored = true;
                } else {
                    switch (confDiagLevel) {
                        case "ignore":
                            if (isUnkownFuncDiag) {
                                ignored = true;
                            }
                            break;
                    
                        case "warn":
                                if (isUnkownFuncDiag) {
                                    u.severity = DiagnosticSeverity.Warning;
                                }
                            break;
                        default:
                            break;
                    }
                }
    
                if (ignored === false){
                    const diagItem = new vscode.Diagnostic(
                        new vscode.Range(
                            new vscode.Position(u.range.start.line - 1, u.range.start.character),
                            new vscode.Position(u.range.end.line - 1, u.range.end.character)),
                        u.message,
                        u.severity
                    );
                    vscodeDiagnostics.push(diagItem);
github microsoft / BotBuilder-Samples / experimental / adaptive-tool / src / lg / providers / diagnostics.ts View on Github external
if (isUnkownFuncDiag === true){
            let ignored = false;
            const funcName = extractFuncName(u.message);
            if (customFunctionList.includes(funcName)) {
                ignored = true;
            } else {
                switch (confDiagLevel) {
                    case "ignore":
                        if (isUnkownFuncDiag) {
                            ignored = true;
                        }
                        break;
                
                    case "warn":
                            if (isUnkownFuncDiag) {
                                u.severity = DiagnosticSeverity.Warning;
                            }
                        break;
                    default:
                        break;
                }
            }

            if (ignored === false){
                const diagItem = new vscode.Diagnostic(
                    new vscode.Range(
                        new vscode.Position(u.range.start.line - 1 < 0 ? 0 : u.range.start.line - 1, u.range.start.character),
                        new vscode.Position(u.range.end.line - 1 < 0 ? 0 : u.range.end.line - 1, u.range.end.character)),
                    u.message,
                    u.severity
                );
                vscodeDiagnostics.push(diagItem);
github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / language-generation / src / utils.ts View on Github external
const matchIndex = match.index || 0;
    if (matchIndex > pos) {
      return undefined;
    } else if (wordDefinition.lastIndex >= pos) {
      return Range.create(line, matchIndex, line, wordDefinition.lastIndex);
    }
  }

  return undefined;
}

const severityMap = {
  [LGDiagnosticSeverity.Error]: DiagnosticSeverity.Error,
  [LGDiagnosticSeverity.Hint]: DiagnosticSeverity.Hint,
  [LGDiagnosticSeverity.Information]: DiagnosticSeverity.Information,
  [LGDiagnosticSeverity.Warning]: DiagnosticSeverity.Warning,
};

export function convertSeverity(severity: LGDiagnosticSeverity): DiagnosticSeverity {
  return severityMap[severity];
}

export function convertDiagnostics(lgDiags: LGDiagnostic[] = [], document: TextDocument, lineOffset = 0): Diagnostic[] {
  const diagnostics: Diagnostic[] = [];
  lgDiags.forEach(diag => {
    const diagnostic: Diagnostic = {
      severity: convertSeverity(diag.Severity),
      range: Range.create(
        Position.create(diag.Range.Start.Line - 1 - lineOffset, diag.Range.Start.Character),
        Position.create(diag.Range.End.Line - 1 - lineOffset, diag.Range.End.Character)
      ),
      message: diag.Message,