Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
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);
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,