mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 23:36:00 +02:00
Added error/warning panel, region support
This commit is contained in:
parent
c63edcbf87
commit
8970ebcd93
33 changed files with 454 additions and 130 deletions
|
@ -135,7 +135,7 @@ namespace IDE
|
|||
{
|
||||
mScriptManager = new .();
|
||||
mScriptManager.mProjectName = new String(project.mProjectName);
|
||||
mScriptManager.mAllowCompiling = true;
|
||||
mScriptManager.mIsBuildScript = true;
|
||||
mScriptManager.mSoftFail = true;
|
||||
mScriptManager.mVerbosity = gApp.mVerbosity;
|
||||
didCommands = true;
|
||||
|
|
|
@ -250,6 +250,8 @@ namespace IDE
|
|||
Add("Show Class View", new => gApp.ShowClassViewPanel);
|
||||
Add("Show Current", new => gApp.Cmd_ShowCurrent);
|
||||
Add("Show Disassembly", new => gApp.[Friend]ShowDisassemblyAtStack);
|
||||
Add("Show Errors", new => gApp.[Friend]ShowErrors);
|
||||
Add("Show Error Next", new => gApp.ShowErrorNext);
|
||||
Add("Show File Externally", new => gApp.Cmd_ShowFileExternally);
|
||||
Add("Show Find Results", new => gApp.ShowFindResults);
|
||||
Add("Show Fixit", new => gApp.Cmd_ShowFixit);
|
||||
|
|
|
@ -8,6 +8,7 @@ using Beefy.widgets;
|
|||
using Beefy;
|
||||
using Beefy.utils;
|
||||
using IDE.Util;
|
||||
using IDE.ui;
|
||||
|
||||
namespace IDE.Compiler
|
||||
{
|
||||
|
@ -295,6 +296,8 @@ namespace IDE.Compiler
|
|||
|
||||
protected override void DoProcessQueue()
|
||||
{
|
||||
BfPassInstance.PassKind passKind = .None;
|
||||
|
||||
BfPassInstance passInstance = null;
|
||||
bool didPassInstanceAlloc = false;
|
||||
|
||||
|
@ -312,6 +315,23 @@ namespace IDE.Compiler
|
|||
command = mCommandQueue[0];
|
||||
}
|
||||
|
||||
bool commandProcessed = true;
|
||||
defer
|
||||
{
|
||||
if (commandProcessed)
|
||||
{
|
||||
using (mMonitor.Enter())
|
||||
{
|
||||
delete command;
|
||||
if (!mShuttingDown)
|
||||
{
|
||||
var poppedCmd = mCommandQueue.PopFront();
|
||||
Debug.Assert(poppedCmd == command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (command is SetPassInstanceCommand)
|
||||
{
|
||||
var setPassInstanceCommand = (SetPassInstanceCommand)command;
|
||||
|
@ -345,9 +365,12 @@ namespace IDE.Compiler
|
|||
var projectSource = projectSourceCommand.mProjectSource;
|
||||
if (projectSource.mIncludeKind != .Ignore)
|
||||
{
|
||||
BfProject bfProject = null;
|
||||
|
||||
using (projectSource.mProject.mMonitor.Enter())
|
||||
{
|
||||
projectSourceCommand.mProjectSource.GetFullImportPath(sourceFilePath);
|
||||
bfProject = mBfSystem.GetBfProject(projectSource.mProject);
|
||||
}
|
||||
|
||||
bool canMoveSourceString = true;
|
||||
|
@ -389,10 +412,15 @@ namespace IDE.Compiler
|
|||
else
|
||||
bfParser.SetSource("", sourceFilePath);
|
||||
bfParser.SetCharIdData(ref char8IdData);
|
||||
|
||||
//passInstance.SetProject(bfProject);
|
||||
worked &= bfParser.Parse(passInstance, false);
|
||||
worked &= bfParser.Reduce(passInstance);
|
||||
//passInstance.SetProject(bfProject);
|
||||
worked &= bfParser.BuildDefs(passInstance, null, false);
|
||||
|
||||
passKind = .Parse;
|
||||
|
||||
// Do this to make sure we re-trigger errors in parse/reduce/builddefs
|
||||
if (!worked)
|
||||
projectSource.HasChangedSinceLastCompile = true;
|
||||
|
@ -402,6 +430,15 @@ namespace IDE.Compiler
|
|||
if (command is ProjectSourceRemovedCommand)
|
||||
{
|
||||
var fileRemovedCommand = (ProjectSourceRemovedCommand)command;
|
||||
let projectSource = fileRemovedCommand.mProjectSource;
|
||||
|
||||
using (projectSource.mProject.mMonitor.Enter())
|
||||
{
|
||||
String sourceFilePath = scope String();
|
||||
projectSource.GetFullImportPath(sourceFilePath);
|
||||
gApp.mErrorsPanel.ClearParserErrors(sourceFilePath);
|
||||
}
|
||||
|
||||
var bfParser = mBfSystem.FileRemoved(fileRemovedCommand.mProjectSource);
|
||||
if (bfParser != null)
|
||||
{
|
||||
|
@ -421,13 +458,24 @@ namespace IDE.Compiler
|
|||
|
||||
if (command is ResolveAllCommand)
|
||||
{
|
||||
if (passKind != .None)
|
||||
{
|
||||
commandProcessed = false;
|
||||
break;
|
||||
}
|
||||
|
||||
var resolvePassData = BfResolvePassData.Create(ResolveType.Classify);
|
||||
// If we get canceled then try again after waiting a couple updates
|
||||
if (!ClassifySource(passInstance, null, resolvePassData, null))
|
||||
QueueDeferredResolveAll();
|
||||
|
||||
delete resolvePassData;
|
||||
mBfSystem.RemoveOldParsers();
|
||||
mBfSystem.RemoveOldData();
|
||||
passKind = .Classify;
|
||||
|
||||
// End after resolveAll
|
||||
break;
|
||||
}
|
||||
|
||||
if (command is SetWorkspaceOptionsCommand)
|
||||
|
@ -444,22 +492,16 @@ namespace IDE.Compiler
|
|||
{
|
||||
mWantsActiveViewRefresh = true;
|
||||
}
|
||||
|
||||
using (mMonitor.Enter())
|
||||
{
|
||||
delete command;
|
||||
if (!mShuttingDown)
|
||||
{
|
||||
var poppedCmd = mCommandQueue.PopFront();
|
||||
Debug.Assert(poppedCmd == command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mBfSystem.Unlock();
|
||||
|
||||
if (didPassInstanceAlloc)
|
||||
delete passInstance;
|
||||
{
|
||||
if ((passKind != .None) && (mIsResolveOnly))
|
||||
gApp.mErrorsPanel.ProcessPassInstance(passInstance, passKind);
|
||||
delete passInstance;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleOptions(BfProject hotBfProject, int32 hotIdx)
|
||||
|
|
|
@ -10,6 +10,13 @@ namespace IDE.Compiler
|
|||
{
|
||||
public class BfPassInstance
|
||||
{
|
||||
public enum PassKind
|
||||
{
|
||||
None,
|
||||
Parse,
|
||||
Classify
|
||||
}
|
||||
|
||||
[StdCall, CLink]
|
||||
static extern void BfPassInstance_Delete(void* bfSystem);
|
||||
|
||||
|
@ -23,12 +30,12 @@ namespace IDE.Compiler
|
|||
static extern int32 BfPassInstance_GetErrorCount(void* mNativeResolvePassData);
|
||||
|
||||
[StdCall, CLink]
|
||||
static extern char8* BfPassInstance_GetErrorData(void* mNativeResolvePassData, int32 errorIdx, out bool isWarning,
|
||||
out bool isAfter, out bool isDeferred, out bool isWhileSpecializing,
|
||||
out bool isPersistent, out int32 srcStart, out int32 srcEnd, out int32 moreInfoCount);
|
||||
static extern char8* BfPassInstance_GetErrorData(void* mNativeResolvePassData, int32 errorIdx, out int32 code, out bool isWarning,
|
||||
out bool isAfter, out bool isDeferred, out bool isWhileSpecializing, out bool isPersistent, out char8* projectName,
|
||||
out char8* fileName, out int32 srcStart, out int32 srcEnd, int32* srcLine, int32* srcColumn, out int32 moreInfoCount);
|
||||
|
||||
[StdCall, CLink]
|
||||
static extern char8* BfPassInstance_Error_GetMoreInfoData(void* mNativeResolvePassData, int32 errorIdx, int32 moreInfoIdx, out char8* fileName, out int32 srcStart, out int32 srcEnd);
|
||||
static extern char8* BfPassInstance_Error_GetMoreInfoData(void* mNativeResolvePassData, int32 errorIdx, int32 moreInfoIdx, out char8* fileName, out int32 srcStart, out int32 srcEnd, int32* srcLine, int32* srcColumn);
|
||||
|
||||
[StdCall, CLink]
|
||||
static extern bool BfPassInstance_HadSignatureChanges(void* mNativeResolvePassData);
|
||||
|
@ -36,18 +43,22 @@ namespace IDE.Compiler
|
|||
public class BfError
|
||||
{
|
||||
public bool mIsWarning;
|
||||
public int32 mCode;
|
||||
public bool mIsAfter;
|
||||
public bool mIsDeferred;
|
||||
public bool mIsWhileSpecializing;
|
||||
public bool mIsPersistent;
|
||||
public String mProject ~ delete _;
|
||||
public String mError ~ delete _;
|
||||
public int32 mSrcStart;
|
||||
public int32 mSrcEnd;
|
||||
public int32 mLine = -1;
|
||||
public int32 mColumn = -1;
|
||||
public int32 mMoreInfoCount;
|
||||
public bool mOwnsSpan;
|
||||
public IdSpan mIdSpan ~ { if (mOwnsSpan) _.Dispose(); };
|
||||
public int32 mErrorIdx = -1;
|
||||
public String mFileName ~ delete _;
|
||||
public String mFilePath ~ delete _;
|
||||
public List<BfError> mMoreInfo ~ DeleteContainerAndItems!(_);
|
||||
}
|
||||
|
||||
|
@ -110,21 +121,30 @@ namespace IDE.Compiler
|
|||
return BfPassInstance_GetErrorCount(mNativeBfPassInstance);
|
||||
}
|
||||
|
||||
public void GetErrorData(int32 errorIdx, BfError bfError)
|
||||
public void GetErrorData(int32 errorIdx, BfError bfError, bool getLine = false)
|
||||
{
|
||||
Debug.Assert(bfError.mError == null);
|
||||
bfError.mErrorIdx = errorIdx;
|
||||
bfError.mError = new String(BfPassInstance_GetErrorData(mNativeBfPassInstance, errorIdx, out bfError.mIsWarning, out bfError.mIsAfter, out bfError.mIsDeferred,
|
||||
out bfError.mIsWhileSpecializing, out bfError.mIsPersistent, out bfError.mSrcStart, out bfError.mSrcEnd, out bfError.mMoreInfoCount));
|
||||
char8* projectName = null;
|
||||
char8* fileName = null;
|
||||
bfError.mError = new String(BfPassInstance_GetErrorData(mNativeBfPassInstance, errorIdx, out bfError.mCode, out bfError.mIsWarning, out bfError.mIsAfter, out bfError.mIsDeferred,
|
||||
out bfError.mIsWhileSpecializing, out bfError.mIsPersistent, out projectName, out fileName, out bfError.mSrcStart, out bfError.mSrcEnd,
|
||||
getLine ? &bfError.mLine : null, getLine ? &bfError.mColumn : null,
|
||||
out bfError.mMoreInfoCount));
|
||||
if (projectName != null)
|
||||
bfError.mProject = new String(projectName);
|
||||
if (fileName != null)
|
||||
bfError.mFilePath = new String(fileName);
|
||||
}
|
||||
|
||||
public void GetMoreInfoErrorData(int32 errorIdx, int32 moreInfoIdx, BfError bfError)
|
||||
public void GetMoreInfoErrorData(int32 errorIdx, int32 moreInfoIdx, BfError bfError, bool getLine = false)
|
||||
{
|
||||
char8* fileName = null;
|
||||
char8* errorStr = BfPassInstance_Error_GetMoreInfoData(mNativeBfPassInstance, errorIdx, moreInfoIdx, out fileName, out bfError.mSrcStart, out bfError.mSrcEnd);
|
||||
Debug.Assert(bfError.mFileName == null);
|
||||
char8* errorStr = BfPassInstance_Error_GetMoreInfoData(mNativeBfPassInstance, errorIdx, moreInfoIdx, out fileName, out bfError.mSrcStart, out bfError.mSrcEnd,
|
||||
getLine ? &bfError.mLine : null, getLine ? &bfError.mColumn : null);
|
||||
Debug.Assert(bfError.mFilePath == null);
|
||||
if (fileName != null)
|
||||
bfError.mFileName = new String(fileName);
|
||||
bfError.mFilePath = new String(fileName);
|
||||
if (bfError.mError == null)
|
||||
bfError.mError = new String(errorStr);
|
||||
else
|
||||
|
|
|
@ -176,6 +176,7 @@ namespace IDE
|
|||
public WatchPanel mWatchPanel;
|
||||
public MemoryPanel mMemoryPanel;
|
||||
public CallStackPanel mCallStackPanel;
|
||||
public ErrorsPanel mErrorsPanel;
|
||||
public BreakpointPanel mBreakpointPanel;
|
||||
public ModulePanel mModulePanel;
|
||||
public ThreadPanel mThreadPanel;
|
||||
|
@ -625,6 +626,7 @@ namespace IDE
|
|||
|
||||
RemoveAndDelete!(mProjectPanel);
|
||||
RemoveAndDelete!(mClassViewPanel);
|
||||
RemoveAndDelete!(mErrorsPanel);
|
||||
RemoveAndDelete!(mOutputPanel);
|
||||
RemoveAndDelete!(mImmediatePanel);
|
||||
RemoveAndDelete!(mFindResultsPanel);
|
||||
|
@ -4327,6 +4329,18 @@ namespace IDE
|
|||
ShowPanel(mCallStackPanel, "Call Stack");
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
public void ShowErrors()
|
||||
{
|
||||
ShowPanel(mErrorsPanel, "Errors");
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
public void ShowErrorNext()
|
||||
{
|
||||
mErrorsPanel.ShowErrorNext();
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
public void ShowWatches()
|
||||
{
|
||||
|
@ -4868,20 +4882,21 @@ namespace IDE
|
|||
//////////
|
||||
|
||||
subMenu = root.AddMenuItem("&View");
|
||||
AddMenuItem(subMenu, "Work&space Explorer", "Show Workspace Explorer");
|
||||
AddMenuItem(subMenu, "C&lass View", "Show Class View");
|
||||
AddMenuItem(subMenu, "&Immediate Window", "Show Immediate");
|
||||
AddMenuItem(subMenu, "&Threads", "Show Threads");
|
||||
AddMenuItem(subMenu, "A&utoComplete", "Show Autocomplete Panel");
|
||||
AddMenuItem(subMenu, "&Auto Watches", "Show Auto Watches");
|
||||
AddMenuItem(subMenu, "&Breakpoints", "Show Breakpoints");
|
||||
AddMenuItem(subMenu, "&Call Stack", "Show Call Stack");
|
||||
AddMenuItem(subMenu, "&Watches", "Show Watches");
|
||||
AddMenuItem(subMenu, "&Auto Watches", "Show Auto Watches");
|
||||
AddMenuItem(subMenu, "&Breakpoints", "Show Breakpoints");
|
||||
AddMenuItem(subMenu, "C&lass View", "Show Class View");
|
||||
AddMenuItem(subMenu, "E&rrors", "Show Errors");
|
||||
AddMenuItem(subMenu, "&Find Results", "Show Find Results");
|
||||
AddMenuItem(subMenu, "&Immediate Window", "Show Immediate");
|
||||
AddMenuItem(subMenu, "&Memory", "Show Memory");
|
||||
AddMenuItem(subMenu, "Mo&dules", "Show Modules");
|
||||
AddMenuItem(subMenu, "&Output", "Show Output");
|
||||
AddMenuItem(subMenu, "&Find Results", "Show Find Results");
|
||||
AddMenuItem(subMenu, "&Profiler", "Show Profiler");
|
||||
AddMenuItem(subMenu, "A&utoComplete", "Show Autocomplete Panel");
|
||||
AddMenuItem(subMenu, "&Threads", "Show Threads");
|
||||
AddMenuItem(subMenu, "&Watches", "Show Watches");
|
||||
AddMenuItem(subMenu, "Work&space Explorer", "Show Workspace Explorer");
|
||||
subMenu.AddMenuItem(null);
|
||||
AddMenuItem(subMenu, "Next Document Panel", "Next Document Panel");
|
||||
AddMenuItem(subMenu, "Navigate Backwards", "Navigate Backwards");
|
||||
|
@ -8904,7 +8919,7 @@ namespace IDE
|
|||
bool bfHadOutputChanges;
|
||||
List<String> bfFileNames = scope List<String>();
|
||||
bfCompiler.GetOutputFileNames(bfProject, false, out bfHadOutputChanges, bfFileNames);
|
||||
defer(scope) ClearAndDeleteItems(bfFileNames);
|
||||
defer ClearAndDeleteItems(bfFileNames);
|
||||
if (bfHadOutputChanges)
|
||||
project.mNeedsTargetRebuild = true;
|
||||
}
|
||||
|
@ -10227,6 +10242,8 @@ namespace IDE
|
|||
mCallStackPanel.mAutoDelete = false;
|
||||
mBreakpointPanel = new BreakpointPanel();
|
||||
mBreakpointPanel.mAutoDelete = false;
|
||||
mErrorsPanel = new ErrorsPanel();
|
||||
mErrorsPanel.mAutoDelete = false;
|
||||
mModulePanel = new ModulePanel();
|
||||
mModulePanel.mAutoDelete = false;
|
||||
mThreadPanel = new ThreadPanel();
|
||||
|
@ -10857,6 +10874,9 @@ namespace IDE
|
|||
didClean = true;
|
||||
OutputLine("Cleaned Beef.");
|
||||
|
||||
if (mErrorsPanel != null)
|
||||
mErrorsPanel.ClearParserErrors(null);
|
||||
|
||||
delete mBfResolveCompiler;
|
||||
delete mBfResolveSystem;
|
||||
delete mBfResolveHelper;
|
||||
|
@ -10932,6 +10952,9 @@ namespace IDE
|
|||
{
|
||||
OutputLine("Cleaned.");
|
||||
|
||||
if (mErrorsPanel != null)
|
||||
mErrorsPanel.ClearParserErrors(null);
|
||||
|
||||
let workspaceOptions = GetCurWorkspaceOptions();
|
||||
|
||||
delete mBfResolveHelper;
|
||||
|
@ -11038,17 +11061,17 @@ namespace IDE
|
|||
}
|
||||
}
|
||||
|
||||
CurrentWorkspaceConfigChanged();
|
||||
|
||||
if (mBfResolveSystem != null)
|
||||
{
|
||||
for (var project in mWorkspace.mProjects)
|
||||
/*for (var project in mWorkspace.mProjects)
|
||||
{
|
||||
if (IsProjectEnabled(project))
|
||||
QueueProjectItems(project);
|
||||
}
|
||||
}*/
|
||||
mBfResolveCompiler.QueueDeferredResolveAll();
|
||||
}
|
||||
|
||||
CurrentWorkspaceConfigChanged();
|
||||
}
|
||||
|
||||
mBfBuildSystem.Update();
|
||||
|
@ -11519,6 +11542,8 @@ namespace IDE
|
|||
|
||||
if ((mBuildContext == null) && (!IsCompiling))
|
||||
DeleteAndNullify!(mLaunchData);
|
||||
|
||||
mErrorsPanel?.CheckResolveAll();
|
||||
}
|
||||
|
||||
public void ShowPassOutput(BfPassInstance bfPassInstance)
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace IDE
|
|||
public String mExpectingError ~ delete _;
|
||||
public bool mHadExpectingError;
|
||||
public int mDoneTicks;
|
||||
public bool mAllowCompiling;
|
||||
public bool mIsBuildScript;
|
||||
public bool mSoftFail;
|
||||
public Verbosity mVerbosity = .Quiet;
|
||||
public String mProjectName ~ delete _;
|
||||
|
@ -950,7 +950,7 @@ namespace IDE
|
|||
|
||||
if (gApp.IsCompiling)
|
||||
{
|
||||
if (!ScriptManager.sActiveManager.mAllowCompiling)
|
||||
if (!ScriptManager.sActiveManager.mIsBuildScript)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -960,8 +960,16 @@ namespace IDE
|
|||
if (gApp.mDebugger == null)
|
||||
return true;
|
||||
|
||||
if ((!gApp.AreTestsRunning()) && (!gApp.mDebugger.HasPendingDebugLoads()) &&
|
||||
((gApp.mExecutionPaused) || (!gApp.mDebugger.mIsRunning)))
|
||||
bool checkRunState = (!gApp.mDebugger.HasPendingDebugLoads()) &&
|
||||
((gApp.mExecutionPaused) || (!gApp.mDebugger.mIsRunning));
|
||||
|
||||
if ((!ScriptManager.sActiveManager.mIsBuildScript) && (gApp.AreTestsRunning()))
|
||||
checkRunState = false;
|
||||
|
||||
/*if (gApp.AreTestsRunning())
|
||||
checkRunState = false;*/
|
||||
|
||||
if (checkRunState)
|
||||
{
|
||||
var runState = gApp.mDebugger.GetRunState();
|
||||
if (runState == .Terminating)
|
||||
|
|
|
@ -451,12 +451,14 @@ namespace IDE
|
|||
Add("Save All", "Ctrl+Shift+S");
|
||||
Add("Save File", "Ctrl+S");
|
||||
Add("Set Next Statement", "Ctrl+Shift+F10");
|
||||
Add("Show Current", "Alt+C");
|
||||
Add("Show Auto Watches", "Ctrl+Alt+A");
|
||||
Add("Show Autocomplete Panel", "Ctrl+Alt+U");
|
||||
Add("Show Breakpoints", "Ctrl+Alt+B");
|
||||
Add("Show Call Stack", "Ctrl+Alt+C");
|
||||
Add("Show Class View", "Ctrl+Alt+L");
|
||||
Add("Show Current", "Alt+C");
|
||||
Add("Show Errors", "Ctrl+Alt+E");
|
||||
Add("Show Error Next", "Ctrl+Shift+F12");
|
||||
Add("Show File Externally", "Ctrl+Tilde");
|
||||
Add("Show Find Results", "Ctrl+Alt+F");
|
||||
Add("Show Fixit", "Ctrl+Period");
|
||||
|
|
|
@ -183,6 +183,9 @@ namespace IDE
|
|||
cmd.Append(clientStr, 0, crPos);
|
||||
clientStr.Remove(0, crPos + 1);
|
||||
|
||||
if (cmd.IsWhiteSpace)
|
||||
continue;
|
||||
|
||||
/*String outStr = scope String();
|
||||
outStr.AppendF("CMD: {0}", cmd);
|
||||
QueueOutput(outStr);*/
|
||||
|
@ -254,6 +257,13 @@ namespace IDE
|
|||
case ":TestFinish":
|
||||
testsFinished = true;
|
||||
default:
|
||||
if ((cmdParts.Count < 5) || (cmdParts[0].StartsWith(":")))
|
||||
{
|
||||
QueueOutputLine("ERROR: Failed communicate with test target '{0}'", curProjectInfo.mTestExePath);
|
||||
TestFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Assert(cmdParts[0][0] != ':');
|
||||
|
||||
let attribs = cmdParts[1];
|
||||
|
@ -347,11 +357,12 @@ namespace IDE
|
|||
}
|
||||
else if (exitCode != 0)
|
||||
{
|
||||
if (exitCode != 0)
|
||||
{
|
||||
QueueOutputLine("ERROR: Test process exited with error code: {0}", exitCode);
|
||||
TestFailed();
|
||||
}
|
||||
QueueOutputLine("ERROR: Test process exited with error code: {0}", exitCode);
|
||||
TestFailed();
|
||||
}
|
||||
else if (testInstance.mTestEntries.IsEmpty)
|
||||
{
|
||||
QueueOutputLine("WARNING: No test methods defined. Consider adding a [Test] attribute to a static method in a project whose build type is set to 'Test'.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,8 @@ namespace IDE.ui
|
|||
public bool mNeedsResolveAll;
|
||||
public bool mErrorsDirty;
|
||||
public Monitor mMonitor = new .() ~ delete _;
|
||||
public List<BfPassInstance.BfError> mErrorList = new .() ~ DeleteContainerAndItems!(_);
|
||||
public Dictionary<String, List<BfPassInstance.BfError>> mParseErrors = new .() ~ delete _;
|
||||
public List<BfPassInstance.BfError> mResolveErrors = new .() ~ DeleteContainerAndItems!(_);
|
||||
public int mDirtyTicks;
|
||||
|
||||
public int mErrorCount;
|
||||
|
@ -98,6 +99,11 @@ namespace IDE.ui
|
|||
AddWidget(mDockingFrame);
|
||||
}
|
||||
|
||||
public ~this()
|
||||
{
|
||||
ClearParserErrors(null);
|
||||
}
|
||||
|
||||
public override void Serialize(StructuredData data)
|
||||
{
|
||||
base.Serialize(data);
|
||||
|
@ -122,12 +128,23 @@ namespace IDE.ui
|
|||
{
|
||||
using (mMonitor.Enter())
|
||||
{
|
||||
mErrorCount = 0;
|
||||
mWarningCount = 0;
|
||||
|
||||
int32 errorCount = passInstance.GetErrorCount();
|
||||
ClearAndDeleteItems(mErrorList);
|
||||
mErrorList.Capacity = mErrorList.Count;
|
||||
if (passKind != .Parse)
|
||||
{
|
||||
if (!mResolveErrors.IsEmpty)
|
||||
mErrorsDirty = true;
|
||||
|
||||
for (let error in mResolveErrors)
|
||||
{
|
||||
if (error.mIsWarning)
|
||||
mWarningCount--;
|
||||
else
|
||||
mErrorCount--;
|
||||
}
|
||||
|
||||
ClearAndDeleteItems(mResolveErrors);
|
||||
mResolveErrors.Capacity = mResolveErrors.Count;
|
||||
}
|
||||
|
||||
for (int32 errorIdx = 0; errorIdx < errorCount; errorIdx++)
|
||||
{
|
||||
|
@ -148,16 +165,61 @@ namespace IDE.ui
|
|||
bfError.mMoreInfo.Add(moreInfo);
|
||||
}
|
||||
|
||||
mErrorList.Add(bfError);
|
||||
}
|
||||
if (passKind == .Parse)
|
||||
{
|
||||
bool added = mParseErrors.TryAdd(bfError.mFilePath, var keyPtr, var valuePtr);
|
||||
if (added)
|
||||
{
|
||||
*keyPtr = new .(bfError.mFilePath);
|
||||
*valuePtr = new .();
|
||||
}
|
||||
(*valuePtr).Add(bfError);
|
||||
}
|
||||
else
|
||||
mResolveErrors.Add(bfError);
|
||||
|
||||
mErrorsDirty = true;
|
||||
mErrorsDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearParserErrors(StringView filePath)
|
||||
public void ClearParserErrors(String filePath)
|
||||
{
|
||||
using (mMonitor.Enter())
|
||||
{
|
||||
void DeleteErrorList(List<BfPassInstance.BfError> list)
|
||||
{
|
||||
for (let error in list)
|
||||
{
|
||||
if (error.mIsWarning)
|
||||
mWarningCount--;
|
||||
else
|
||||
mErrorCount--;
|
||||
delete error;
|
||||
}
|
||||
delete list;
|
||||
}
|
||||
|
||||
if (filePath == null)
|
||||
{
|
||||
for (var kv in mParseErrors)
|
||||
{
|
||||
delete kv.key;
|
||||
DeleteErrorList(kv.value);
|
||||
mErrorsDirty = true;
|
||||
}
|
||||
mParseErrors.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mParseErrors.GetAndRemove(filePath) case .Ok((let key, let list)))
|
||||
{
|
||||
delete key;
|
||||
DeleteErrorList(list);
|
||||
mErrorsDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessErrors()
|
||||
|
@ -168,7 +230,8 @@ namespace IDE.ui
|
|||
{
|
||||
let root = mErrorLV.GetRoot();
|
||||
|
||||
for (let error in mErrorList)
|
||||
int idx = 0;
|
||||
void HandleError(BfPassInstance.BfError error)
|
||||
{
|
||||
ErrorsListViewItem item;
|
||||
|
||||
|
@ -181,7 +244,6 @@ namespace IDE.ui
|
|||
item.Label = str;
|
||||
}
|
||||
|
||||
int idx = @error.Index;
|
||||
if (idx >= root.GetChildCount())
|
||||
{
|
||||
item = (.)root.CreateChildItem();
|
||||
|
@ -225,9 +287,28 @@ namespace IDE.ui
|
|||
|
||||
if (changed)
|
||||
item.Focused = false;
|
||||
|
||||
idx++;
|
||||
}
|
||||
|
||||
while (root.GetChildCount() > mErrorList.Count)
|
||||
if (!mParseErrors.IsEmpty)
|
||||
{
|
||||
List<String> paths = scope .();
|
||||
for (var path in mParseErrors.Keys)
|
||||
paths.Add(path);
|
||||
paths.Sort();
|
||||
|
||||
for (var path in paths)
|
||||
{
|
||||
for (var error in mParseErrors[path])
|
||||
HandleError(error);
|
||||
}
|
||||
}
|
||||
|
||||
for (let error in mResolveErrors)
|
||||
HandleError(error);
|
||||
|
||||
while (root.GetChildCount() > idx)
|
||||
root.RemoveChildItemAt(root.GetChildCount() - 1);
|
||||
|
||||
mErrorsDirty = false;
|
||||
|
@ -277,7 +358,7 @@ namespace IDE.ui
|
|||
|
||||
bool foundFocused = false;
|
||||
let root = mErrorLV.GetRoot();
|
||||
if (root.mChildItems == null)
|
||||
if (root.GetChildCount() == 0)
|
||||
return;
|
||||
for (let lvItem in root.mChildItems)
|
||||
{
|
||||
|
|
|
@ -195,7 +195,7 @@ namespace IDE.ui
|
|||
if (mShowingDropdown)
|
||||
return null;
|
||||
mShowingDropdown = true;
|
||||
defer(scope) { mShowingDropdown = false; }
|
||||
defer { mShowingDropdown = false; }
|
||||
|
||||
/*var stopWatch = scope Stopwatch();
|
||||
stopWatch.Start();*/
|
||||
|
|
|
@ -97,6 +97,10 @@ namespace IDE.ui
|
|||
{
|
||||
panel = gApp.mImmediatePanel;
|
||||
}
|
||||
else if (type == "ErrorsPanel")
|
||||
{
|
||||
panel = gApp.mErrorsPanel;
|
||||
}
|
||||
else if (type == "FindResultsPanel")
|
||||
{
|
||||
panel = gApp.mFindResultsPanel;
|
||||
|
|
|
@ -868,7 +868,7 @@ namespace IDE.ui
|
|||
String dir = scope String(fileDialog.InitialDirectory);
|
||||
|
||||
List<String> alreadyHadFileList = scope List<String>();
|
||||
defer(scope) ClearAndDeleteItems(alreadyHadFileList);
|
||||
defer ClearAndDeleteItems(alreadyHadFileList);
|
||||
|
||||
for (String fileNameIn in fileDialog.FileNames)
|
||||
{
|
||||
|
|
|
@ -1653,6 +1653,9 @@ namespace IDE.ui
|
|||
if (gApp.mDbgDelayedAutocomplete)
|
||||
Thread.Sleep(250);
|
||||
|
||||
if ((resolveType == .Classify) || (resolveType == .ClassifyFullRefresh))
|
||||
gApp.mErrorsPanel.SetNeedsResolveAll();
|
||||
|
||||
/*if (resolveType == .Autocomplete)
|
||||
{
|
||||
Thread.Sleep(250);
|
||||
|
@ -1818,6 +1821,13 @@ namespace IDE.ui
|
|||
resolvePassData.SetDocumentationRequest(resolveParams.mDocumentationName);
|
||||
parser.Parse(passInstance, !mIsBeefSource);
|
||||
parser.Reduce(passInstance);
|
||||
|
||||
if ((mIsBeefSource) &&
|
||||
((resolveType == .Classify) || (resolveType == .ClassifyFullRefresh)))
|
||||
{
|
||||
gApp.mErrorsPanel.ClearParserErrors(mFilePath);
|
||||
gApp.mErrorsPanel.ProcessPassInstance(passInstance, .Parse);
|
||||
}
|
||||
|
||||
if (isInterrupt)
|
||||
{
|
||||
|
@ -2511,13 +2521,16 @@ namespace IDE.ui
|
|||
if (trackedElement.mSnapToLineStart)
|
||||
{
|
||||
int32 lineLeft = trackedElementView.mTextPosition.mIndex;
|
||||
repeat
|
||||
{
|
||||
if (!((char8)editContent.mData.mText[lineLeft].mChar).IsWhiteSpace)
|
||||
startContentIdx = lineLeft;
|
||||
lineLeft--;
|
||||
}
|
||||
while ((lineLeft > 0) && (editContent.mData.mText[lineLeft].mChar != '\n'));
|
||||
if (lineLeft < editContent.mData.mTextLength)
|
||||
{
|
||||
repeat
|
||||
{
|
||||
if (!((char8)editContent.mData.mText[lineLeft].mChar).IsWhiteSpace)
|
||||
startContentIdx = lineLeft;
|
||||
lineLeft--;
|
||||
}
|
||||
while ((lineLeft > 0) && (editContent.mData.mText[lineLeft].mChar != '\n'));
|
||||
}
|
||||
|
||||
if (startContentIdx == -1)
|
||||
{
|
||||
|
@ -4926,7 +4939,7 @@ namespace IDE.ui
|
|||
{
|
||||
for (var moreInfo in bestError.mMoreInfo)
|
||||
{
|
||||
showMouseoverString.AppendF("\n@{0}\t{1}\t{2}", moreInfo.mFileName, moreInfo.mSrcStart, moreInfo.mError);
|
||||
showMouseoverString.AppendF("\n@{0}\t{1}\t{2}", moreInfo.mFilePath, moreInfo.mSrcStart, moreInfo.mError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -365,9 +365,21 @@ namespace IDE.ui
|
|||
else
|
||||
mStatusBoxUpdateCnt = -1;
|
||||
|
||||
///
|
||||
{
|
||||
if (gApp.mErrorsPanel.mErrorCount > 0)
|
||||
{
|
||||
g.Draw(DarkTheme.sDarkTheme.GetImage(.CodeError), GS!(6), 0);
|
||||
}
|
||||
else if (gApp.mErrorsPanel.mWarningCount > 0)
|
||||
{
|
||||
g.Draw(DarkTheme.sDarkTheme.GetImage(.CodeWarning), GS!(6), 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (gApp.mSettings.mEnableDevMode)
|
||||
{
|
||||
g.DrawString(StackStringFormat!("FPS: {0}", gApp.mLastFPS), GS!(4), 0);
|
||||
g.DrawString(StackStringFormat!("FPS: {0}", gApp.mLastFPS), GS!(32), 0);
|
||||
|
||||
String resolveStr = scope String();
|
||||
let bfResolveCompiler = gApp.mBfResolveCompiler;
|
||||
|
@ -418,5 +430,16 @@ namespace IDE.ui
|
|||
g.DrawString(resolveStr, GS!(100), 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void MouseDown(float x, float y, int32 btn, int32 btnCount)
|
||||
{
|
||||
base.MouseDown(x, y, btn, btnCount);
|
||||
|
||||
if (Rect(GS!(6), 0, GS!(20), mHeight).Contains(x, y))
|
||||
{
|
||||
gApp.mErrorsPanel.ShowErrorNext();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue