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)
|
foreach (ErrorRecord error in errors)
|
||||||
{
|
{
|
||||||
var l = Math.Max(0, error.Line);
|
var l = error.Line;
|
||||||
var c = Math.Max(0, error.Column);
|
var c = error.Column;
|
||||||
var msg = error.Message;
|
var msg = error.Message;
|
||||||
var ctx = error.Context;
|
var ctx = error.Context ?? "";
|
||||||
|
|
||||||
const string compilerError = "Iris error";
|
var diagnostic = error.Warning
|
||||||
var diagnostic = error.Warning ? Diagnostic.Warning(compilerError) : Diagnostic.Error(compilerError);
|
? Diagnostic.Warning(msg)
|
||||||
|
: Diagnostic.Error(msg);
|
||||||
|
|
||||||
report.AddDiagnostic(diagnostic
|
if (ctx is not null && error.Line >= 0 && error.Column >= 0)
|
||||||
.WithCode("UIX0000")
|
{
|
||||||
.WithLabel(new(ctx, new Location(l, c), msg))
|
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);
|
TraceSettings.Current.SetCategoryLevel(TraceCategory.Markup, byte.MaxValue);
|
||||||
@@ -70,6 +78,8 @@ public class CompileCommand : Command<CompileCommand.Settings>
|
|||||||
|
|
||||||
var success = MarkupCompiler.Compile(compilands, dataTableInput);
|
var success = MarkupCompiler.Compile(compilands, dataTableInput);
|
||||||
|
|
||||||
|
report.Render(AnsiConsole.Console);
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
AnsiConsole.MarkupLine("[red]Compilation failed.[/]");
|
AnsiConsole.MarkupLine("[red]Compilation failed.[/]");
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"UIXC": {
|
"UIXC": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"commandLineArgs": "decompile CONTEXTMENU.UIX --verbose -A UIXControls.dll -I D:\\Documents\\REProj\\Zune\\UIXControls48"
|
"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