Fixed another line number issue. God they practically make themselves

This commit is contained in:
Noah Santschi-Cooney 2018-08-05 00:29:37 +01:00
parent 6fd02abd9d
commit 2d5d074157
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48

View file

@ -289,15 +289,17 @@ function processErrors(out: string, docURI: string, diagnostics: Map<string, Dia
msg: match[4]
}
const fileName = error.file.length - 1 ? error.file : docURI
const diag: Diagnostic = {
severity: error.type,
// had to do - 2 here instead of - 1, windows only perhaps?
range: calcRange(error.line - (win ? 2 : 1), error.file.length - 1 ? error.file : docURI),
range: calcRange(error.line - ((!hasDirective && includeGraph.get(fileName).parents.size === 0) ? 2 : 1), fileName),
message: `Line ${error.line} ${replaceWords(error.msg)}`,
source: 'mc-glsl'
}
diagnostics.get(error.file.length - 1 ? error.file : docURI).push(diag)
diagnostics.get(fileName).push(diag)
// if is an include, highlight an error in the parents line of inclusion
propogateDiagnostic(error, diagnostics, hasDirective)