mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-07-23 03:05:44 +00:00
Prefixed include error with include filename
This commit is contained in:
parent
682e677ee9
commit
3e30f359df
1 changed files with 7 additions and 7 deletions
|
@ -192,7 +192,7 @@ function lint(uri: string, lines: string[], includes: Map<string, IncludeObj>) {
|
||||||
includes.forEach(obj => diagnostics.set(obj.path, []))
|
includes.forEach(obj => diagnostics.set(obj.path, []))
|
||||||
|
|
||||||
filterMatches(out).forEach((match) => {
|
filterMatches(out).forEach((match) => {
|
||||||
let [whole, type, file, line, msg] = match
|
const [whole, type, file, line, msg] = match
|
||||||
|
|
||||||
let diag: Diagnostic = {
|
let diag: Diagnostic = {
|
||||||
severity: errorType(type),
|
severity: errorType(type),
|
||||||
|
@ -204,19 +204,19 @@ function lint(uri: string, lines: string[], includes: Map<string, IncludeObj>) {
|
||||||
diagnostics.get(file.length - 1 ? file : uri).push(diag)
|
diagnostics.get(file.length - 1 ? file : uri).push(diag)
|
||||||
|
|
||||||
// if is an include, highlight an error in the parents line of inclusion
|
// if is an include, highlight an error in the parents line of inclusion
|
||||||
while (file !== '0' && file !== uri) {
|
let nextFile = file
|
||||||
|
while (nextFile !== '0' && nextFile !== uri) {
|
||||||
// TODO what if we dont know the top level parent? Feel like thats a non-issue given that we have uri
|
// TODO what if we dont know the top level parent? Feel like thats a non-issue given that we have uri
|
||||||
// TODO prefix error with filename
|
|
||||||
diag = {
|
diag = {
|
||||||
severity: errorType(type),
|
severity: errorType(type),
|
||||||
range: calcRange(includes.get(file).lineNum, includes.get(file).parent),
|
range: calcRange(includes.get(nextFile).lineNum, includes.get(nextFile).parent),
|
||||||
message: replaceWord(msg),
|
message: includes.get(file).path.replace(conf.shaderpacksPath, '') + replaceWord(msg),
|
||||||
source: 'mc-glsl'
|
source: 'mc-glsl'
|
||||||
}
|
}
|
||||||
|
|
||||||
diagnostics.get(includes.get(file).parent).push(diag)
|
diagnostics.get(includes.get(nextFile).parent).push(diag)
|
||||||
|
|
||||||
file = includes.get(file).parent
|
nextFile = includes.get(nextFile).parent
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue