mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Better compiler error reporting
This commit is contained in:
@@ -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.[/]");
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user