Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
doValidate(document) {
if (document.getText().length === 0) {
this.cleanDiagnostics(document);
return;
}
//const jsonDocument = this.getJSONDocument(document);
// this.jsonService.doValidation(document, jsonDocument).then(diagnostics =>
// this.sendDiagnostics(document, diagnostics)
// );
let text = document.getText();
const staticChercher = new lg.StaticChecker();
const lgDiags = staticChercher.checkText(text, '', lg.ImportResolver.fileResolver);
let diagnostics = [];
lgDiags.forEach(diag => {
let diagnostic = {
severity: utils_1.convertSeverity(diag.Severity),
range: {
start: vscode_languageserver_types_1.Position.create(diag.Range.Start.Line - 1, diag.Range.Start.Character),
end: vscode_languageserver_types_1.Position.create(diag.Range.End.Line - 1, diag.Range.End.Character),
},
message: diag.Message,
source: document.uri,
};
diagnostics.push(diagnostic);
});
this.sendDiagnostics(document, diagnostics);
}
cleanDiagnostics(document) {
protected doValidate(document: TextDocument): void {
if (document.getText().length === 0) {
this.cleanDiagnostics(document);
return;
}
//const jsonDocument = this.getJSONDocument(document);
// this.jsonService.doValidation(document, jsonDocument).then(diagnostics =>
// this.sendDiagnostics(document, diagnostics)
// );
let text = document.getText();
const staticChercher = new lg.StaticChecker();
const lgDiags = staticChercher.checkText(text, '', lg.ImportResolver.fileResolver);
let diagnostics: Diagnostic[] = [];
lgDiags.forEach(diag => {
let diagnostic: Diagnostic = {
severity: this.convertSeverity(diag.Severity),
range: {
start: Position.create(diag.Range.Start.Line, diag.Range.Start.Character),
end: Position.create(diag.Range.End.Line, diag.Range.End.Character),
},
message: diag.Message,
source: document.uri,
};
diagnostics.push(diagnostic);
});
this.sendDiagnostics(document, diagnostics);
}
protected doValidate(document: TextDocument): void {
if (document.getText().length === 0) {
this.cleanDiagnostics(document);
return;
}
let text = document.getText();
const staticChercher = new lg.StaticChecker();
const lgDiags = staticChercher.checkText(text, '', lg.ImportResolver.fileResolver);
let diagnostics: Diagnostic[] = [];
lgDiags.forEach(diag => {
let diagnostic: Diagnostic = {
severity: convertSeverity(diag.Severity),
range: {
start: Position.create(diag.Range.Start.Line - 1, diag.Range.Start.Character),
end: Position.create(diag.Range.End.Line - 1, diag.Range.End.Character),
},
message: diag.Message,
source: document.uri,
};
diagnostics.push(diagnostic);
});
this.sendDiagnostics(document, diagnostics);
}