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

Merge pull request #1295 from marsej/ErrorsPanel-fix

Fix flaky ShowErrorNext and random re-ordering in ErrorsPanel
This commit is contained in:
Brian Fiete 2021-12-27 19:38:10 +01:00 committed by GitHub
commit 9d63e3e585
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,17 +136,15 @@ namespace IDE.ui
ClearAndDeleteItems(mResolveErrors); ClearAndDeleteItems(mResolveErrors);
mResolveErrors.Capacity = mResolveErrors.Count; mResolveErrors.Capacity = mResolveErrors.Count;
} }
var bfl = scope:: List<BfPassInstance.BfError>();
for (int32 errorIdx = 0; errorIdx < errorCount; errorIdx++) for (int32 errorIdx = 0; errorIdx < errorCount; errorIdx++)
{ {
BfPassInstance.BfError bfError = new BfPassInstance.BfError(); BfPassInstance.BfError bfError = new BfPassInstance.BfError();
passInstance.GetErrorData(errorIdx, bfError, true); passInstance.GetErrorData(errorIdx, bfError, true);
if (bfError.mFilePath == null)
bfError.mFilePath = new String(""); //for sort below
if (bfError.mIsWarning) bfl.Add(bfError);
mWarningCount++;
else
mErrorCount++;
for (int32 moreInfoIdx < bfError.mMoreInfoCount) for (int32 moreInfoIdx < bfError.mMoreInfoCount)
{ {
BfPassInstance.BfError moreInfo = new BfPassInstance.BfError(); BfPassInstance.BfError moreInfo = new BfPassInstance.BfError();
@ -155,12 +153,26 @@ namespace IDE.ui
bfError.mMoreInfo = new List<BfPassInstance.BfError>(); bfError.mMoreInfo = new List<BfPassInstance.BfError>();
bfError.mMoreInfo.Add(moreInfo); bfError.mMoreInfo.Add(moreInfo);
} }
}
function int(int lhs, int rhs) ascLambda = (lhs, rhs) => lhs <=> rhs;
bfl.Sort(scope (lhs, rhs) => ascLambda(lhs.mFilePath.GetHashCode()+lhs.mSrcStart, rhs.mFilePath.GetHashCode()+rhs.mSrcStart));
for (int32 errorIdx = 0; errorIdx < bfl.Count; errorIdx++)
{
var bfError = bfl[errorIdx];
if (bfError.mIsWarning)
{
mWarningCount++;
}
else
mErrorCount++;
if (passKind == .Parse) if (passKind == .Parse)
{ {
if (bfError.mFilePath == null) if (bfError.mFilePath == null)
bfError.mFilePath = new String(""); bfError.mFilePath = new String("");
bool added = mParseErrors.TryAdd(bfError.mFilePath, var keyPtr, var valuePtr); bool added = mParseErrors.TryAdd(bfError.mFilePath, var keyPtr, var valuePtr);
if (added) if (added)
{ {
@ -170,7 +182,7 @@ namespace IDE.ui
(*valuePtr).Add(bfError); (*valuePtr).Add(bfError);
} }
else else
mResolveErrors.Add(bfError); mResolveErrors.Add(bfError);
mDataId++; mDataId++;
} }
@ -354,7 +366,7 @@ namespace IDE.ui
public override void Update() public override void Update()
{ {
base.Update(); base.Update();
if (!mVisible) if (!mVisible)
{ {
// Very dirty // Very dirty
@ -369,7 +381,8 @@ namespace IDE.ui
else else
mDirtyTicks++; mDirtyTicks++;
ProcessErrors(); if(mDirtyTicks==0)
ProcessErrors();
} }
public void SetNeedsResolveAll() public void SetNeedsResolveAll()
@ -379,7 +392,8 @@ namespace IDE.ui
public void ShowErrorNext() public void ShowErrorNext()
{ {
ProcessErrors(); if(mDirtyTicks==0)
ProcessErrors();
bool foundFocused = false; bool foundFocused = false;
let root = mErrorLV.GetRoot(); let root = mErrorLV.GetRoot();