Skip to content

Commit 5093674

Browse files
authored
fix(addon): accident-prone parsing of linting results on windows (#200)
1 parent 30ac6a3 commit 5093674

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

addons/GDQuest_GDScript_formatter/plugin.gd

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -582,16 +582,17 @@ func lint_code(script: GDScript) -> Array:
582582
## Parses a lint issue line and returns a dictionary with issue information
583583
func parse_lint_issue(line: String) -> Dictionary:
584584
# Expected format: filename:line:rule:severity: message
585-
var parts = line.split(":", 4)
586-
if parts.size() < 5:
587-
return { }
588-
589-
return {
590-
"line": int(parts[1]) - 1, # Convert to 0-based indexing
591-
"rule": parts[2],
592-
"severity": parts[3],
593-
"message": parts[4].strip_edges(),
594-
}
585+
var regex = RegEx.new()
586+
regex.compile(r"^(.*\.gd):(\d+):([^:]+):([^:]+):([\s\S]*)$")
587+
var result = regex.search(line)
588+
if result:
589+
return {
590+
"line": int(result.get_string(2)) - 1,
591+
"rule": result.get_string(3),
592+
"severity": result.get_string(4),
593+
"message": result.get_string(5).strip_edges(),
594+
}
595+
return { }
595596

596597

597598
## Applies lint highlighting to the code editor

0 commit comments

Comments
 (0)