1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +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 System.IO;
using System.Threading;
using Beefy;
namespace IDE.Compiler
{
@ -256,9 +257,9 @@ namespace IDE.Compiler
{
var editWidgetContent = (SourceEditWidgetContent)editWidget.Content;
/*let origText = scope String();
editWidget.GetText(origText);
File.WriteAllText(@"c:\temp\orig.txt", origText);*/
let oldText = scope String();
editWidget.GetText(oldText);
/*File.WriteAllText(@"c:\temp\orig.txt", origText);*/
int32[] char8Mapping;
String newText = scope String();
@ -318,9 +319,16 @@ namespace IDE.Compiler
}
else
{
Debug.Assert(oldIdx > expectedOldIdx); // This fails if we have the same ID occur multiple times, or we reorder nodes
if (oldIdx <= expectedOldIdx)
break; // Error - abort
// This fails if we have the same ID occur multiple times, or we reorder nodes
if (oldIdx <= expectedOldIdx)
{
#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;
editWidgetContent.CursorTextPos = i;