Skip to content

Commit 2d5d074

Browse files
committed
Fixed another line number issue. God they practically make themselves
1 parent 6fd02ab commit 2d5d074

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/src/linter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,17 @@ function processErrors(out: string, docURI: string, diagnostics: Map<string, Dia
289289
msg: match[4]
290290
}
291291

292+
const fileName = error.file.length - 1 ? error.file : docURI
293+
292294
const diag: Diagnostic = {
293295
severity: error.type,
294296
// had to do - 2 here instead of - 1, windows only perhaps?
295-
range: calcRange(error.line - (win ? 2 : 1), error.file.length - 1 ? error.file : docURI),
297+
range: calcRange(error.line - ((!hasDirective && includeGraph.get(fileName).parents.size === 0) ? 2 : 1), fileName),
296298
message: `Line ${error.line} ${replaceWords(error.msg)}`,
297299
source: 'mc-glsl'
298300
}
299301

300-
diagnostics.get(error.file.length - 1 ? error.file : docURI).push(diag)
302+
diagnostics.get(fileName).push(diag)
301303

302304
// if is an include, highlight an error in the parents line of inclusion
303305
propogateDiagnostic(error, diagnostics, hasDirective)

0 commit comments

Comments
 (0)