Better compiler error reporting

This commit is contained in:
Yoshi Askharoun
2024-07-07 15:37:27 -05:00
parent 53a150f15d
commit ee522bfc87
2 changed files with 22 additions and 11 deletions
+19 -9
View File
@@ -44,18 +44,26 @@ public class CompileCommand : Command<CompileCommand.Settings>
{
foreach (ErrorRecord error in errors)
{
var l = Math.Max(0, error.Line);
var c = Math.Max(0, error.Column);
var l = error.Line;
var c = error.Column;
var msg = error.Message;
var ctx = error.Context;
var ctx = error.Context ?? "";
const string compilerError = "Iris error";
var diagnostic = error.Warning ? Diagnostic.Warning(compilerError) : Diagnostic.Error(compilerError);
var diagnostic = error.Warning
? Diagnostic.Warning(msg)
: Diagnostic.Error(msg);
report.AddDiagnostic(diagnostic
.WithCode("UIX0000")
.WithLabel(new(ctx, new Location(l, c), msg))
);
if (ctx is not null && error.Line >= 0 && error.Column >= 0)
{
Label label = new(ctx, new Location(l, c), "")
{
Color = error.Warning ? Color.Yellow : Color.Red
};
diagnostic = diagnostic.WithLabel(label);
}
report.AddDiagnostic(diagnostic);
}
};
TraceSettings.Current.SetCategoryLevel(TraceCategory.Markup, byte.MaxValue);
@@ -70,6 +78,8 @@ public class CompileCommand : Command<CompileCommand.Settings>
var success = MarkupCompiler.Compile(compilands, dataTableInput);
report.Render(AnsiConsole.Console);
if (!success)
{
AnsiConsole.MarkupLine("[red]Compilation failed.[/]");
+3 -2
View File
@@ -1,8 +1,9 @@
{
"profiles": {
"UIXC": {
"commandName": "Project",
"commandLineArgs": "decompile CONTEXTMENU.UIX --verbose -A UIXControls.dll -I D:\\Documents\\REProj\\Zune\\UIXControls48"
"commandName": "Project",
"commandLineArgs": "compile \"D:\\Documents\\REProj\\Zune\\UIXA\\UIXControls!ComboBox.uixa\" -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o D:\\Documents\\REProj\\Zune\\UIXA",
"workingDirectory": "C:\\Program Files\\Zune"
}
}
}