1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-11 21:04:10 +02:00

Writes debug text when formatting fails

This commit is contained in:
Brian Fiete 2020-01-31 16:12:42 -08:00
parent 12de9cea4b
commit 94c63d233e

View file

@ -8,6 +8,7 @@ using Beefy.utils;
using IDE.ui; using IDE.ui;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using Beefy;
namespace IDE.Compiler namespace IDE.Compiler
{ {
@ -256,9 +257,9 @@ namespace IDE.Compiler
{ {
var editWidgetContent = (SourceEditWidgetContent)editWidget.Content; var editWidgetContent = (SourceEditWidgetContent)editWidget.Content;
/*let origText = scope String(); let oldText = scope String();
editWidget.GetText(origText); editWidget.GetText(oldText);
File.WriteAllText(@"c:\temp\orig.txt", origText);*/ /*File.WriteAllText(@"c:\temp\orig.txt", origText);*/
int32[] char8Mapping; int32[] char8Mapping;
String newText = scope String(); String newText = scope String();
@ -318,9 +319,16 @@ namespace IDE.Compiler
} }
else else
{ {
Debug.Assert(oldIdx > expectedOldIdx); // This fails if we have the same ID occur multiple times, or we reorder nodes // This fails if we have the same ID occur multiple times, or we reorder nodes
if (oldIdx <= expectedOldIdx) if (oldIdx <= expectedOldIdx)
break; // Error - abort {
#if DEBUG
Utils.WriteTextFile(@"c:\temp\old.txt", oldText);
Utils.WriteTextFile(@"c:\temp\new.txt", newText);
Debug.FatalError("Reformat failed");
#endif
break; // Error - abort
}
int32 charsToDelete = oldIdx - expectedOldIdx; int32 charsToDelete = oldIdx - expectedOldIdx;
editWidgetContent.CursorTextPos = i; editWidgetContent.CursorTextPos = i;