浏览代码

Immediate commands no longer wait for paused

Brian Fiete 6 年之前
父节点
当前提交
3c153d27d2
共有 2 个文件被更改,包括 46 次插入8 次删除
  1. 45 7
      IDE/src/ScriptManager.bf
  2. 1 1
      IDE/src/ui/ImmediateWidget.bf

+ 45 - 7
IDE/src/ScriptManager.bf

@@ -32,7 +32,8 @@ namespace IDE
 		public enum CmdFlags
 		public enum CmdFlags
 		{
 		{
 			None,
 			None,
-			NoLines
+			NoLines,
+			NoWait
 		}
 		}
 
 
 		public class QueuedCmd
 		public class QueuedCmd
@@ -212,6 +213,9 @@ namespace IDE
 						queuedCmd.mSrcFile = new String(filePath);
 						queuedCmd.mSrcFile = new String(filePath);
 						queuedCmd.mLineNum = lineNum;
 						queuedCmd.mLineNum = lineNum;
 
 
+						if (flags.HasFlag(.NoWait))
+							queuedCmd.mNoWait = true; 
+
 						if (line.StartsWith("nowait "))
 						if (line.StartsWith("nowait "))
 						{
 						{
 							queuedCmd.mNoWait = true;
 							queuedCmd.mNoWait = true;
@@ -257,7 +261,7 @@ namespace IDE
 		{
 		{
 			StringStream strStream = scope .(cmds, .Reference);
 			StringStream strStream = scope .(cmds, .Reference);
 			StreamReader reader = scope .(strStream);
 			StreamReader reader = scope .(strStream);
-			QueueCommands(reader, filePath, flags);
+			QueueCommands(reader, filePath, flags); 
 		}
 		}
 
 
 		public void QueueCommandFile(StringView filePath)
 		public void QueueCommandFile(StringView filePath)
@@ -904,7 +908,7 @@ namespace IDE
 						return false;
 						return false;
 					if (sourceViewPanel.[Friend]mWantsFullClassify)
 					if (sourceViewPanel.[Friend]mWantsFullClassify)
 						return false;
 						return false;
-					if (sourceViewPanel.[Friend]mWantsFullRefresh)
+					if (sourceViewPanel.[Friend]mWantsFullRefresh) 
 						return false;
 						return false;
 				}
 				}
 			}
 			}
@@ -2112,9 +2116,9 @@ namespace IDE
 				if (hasError != expectedError)
 				if (hasError != expectedError)
 				{
 				{
 					if (hasError)
 					if (hasError)
-						ScriptManager.sActiveManager.Fail("Unexpected error at line {0} in {1}\n\t", lineIdx + 1, textPanel.mFilePath);
+						mScriptManager.Fail("Unexpected error at line {0} in {1}\n\t", lineIdx + 1, textPanel.mFilePath);
 					else
 					else
-						ScriptManager.sActiveManager.Fail("Expected error at line {0} in {1} but didn't encounter one\n\t", lineIdx + 1, textPanel.mFilePath);
+						mScriptManager.Fail("Expected error at line {0} in {1} but didn't encounter one\n\t", lineIdx + 1, textPanel.mFilePath);
 					return;
 					return;
 				}
 				}
 			}
 			}
@@ -2153,16 +2157,18 @@ namespace IDE
 
 
 				int crPos = dbgContent.IndexOf('\n');
 				int crPos = dbgContent.IndexOf('\n');
 				StringView dbgText = .(dbgContent.Ptr + crPos + 1, dbgContent.Length - crPos - 1);
 				StringView dbgText = .(dbgContent.Ptr + crPos + 1, dbgContent.Length - crPos - 1);
-				let dbgHash = MD5.Hash(.((uint8*)dbgText.Ptr, dbgText.Length));
+				//let dbgHash = MD5.Hash(.((uint8*)dbgText.Ptr, dbgText.Length));
 
 
 				String srcContent = scope .();
 				String srcContent = scope .();
 				File.ReadAllText(srcPath, srcContent, false);
 				File.ReadAllText(srcPath, srcContent, false);
 				let srcHash = MD5.Hash(.((uint8*)srcContent.Ptr, srcContent.Length));
 				let srcHash = MD5.Hash(.((uint8*)srcContent.Ptr, srcContent.Length));
 
 
-				if (dbgHash != srcHash)
+				//if (dbgHash != srcHash)
 				{
 				{
 					String bkuPath = scope .();
 					String bkuPath = scope .();
 					bkuPath.Append(gApp.mInstallDir, "/bku/");
 					bkuPath.Append(gApp.mInstallDir, "/bku/");
+					Directory.CreateDirectory(bkuPath).IgnoreError();
+
 					Path.GetFileNameWithoutExtension(dbgFilePath, bkuPath);
 					Path.GetFileNameWithoutExtension(dbgFilePath, bkuPath);
 					bkuPath.Append("_");
 					bkuPath.Append("_");
 					srcHash.ToString(bkuPath);
 					srcHash.ToString(bkuPath);
@@ -2185,6 +2191,38 @@ namespace IDE
 			}
 			}
 		}
 		}
 
 
+		class DbgFileCtx
+		{
+			public String mFile ~ delete _;
+			public int mIdx;
+		}
+
+		DbgFileCtx mDbgFileCtx ~ delete _;
+
+		[IDECommand]
+		public void StartDebugFiles(String dbgPath)
+		{																		   
+			DeleteAndNullify!(mDbgFileCtx);
+			mDbgFileCtx = new DbgFileCtx();
+			mDbgFileCtx.mFile = new String(dbgPath);
+			ContinueDebugFiles();
+		}
+
+		[IDECommand]
+		public void ContinueDebugFiles()
+		{
+			if (mDbgFileCtx == null)
+			{
+				mScriptManager.Fail("StartDebugFiles required");
+				return;
+			}
+
+			gApp.OutputLine("Compiling debug files {0}", mDbgFileCtx.mIdx); 
+			gApp.ShowOutput();
+			RestoreDebugFilesSpan(mDbgFileCtx.mFile, mDbgFileCtx.mIdx, mDbgFileCtx.mIdx);
+			mDbgFileCtx.mIdx++;
+		}
+
 		[IDECommand]
 		[IDECommand]
 		public void WaitDialog()
 		public void WaitDialog()
 		{
 		{

+ 1 - 1
IDE/src/ui/ImmediateWidget.bf

@@ -338,7 +338,7 @@ namespace IDE.ui
 					if (cmdText.StartsWith("%"))
 					if (cmdText.StartsWith("%"))
 					{
 					{
 						gApp.mScriptManager.Clear();
 						gApp.mScriptManager.Clear();
-						gApp.mScriptManager.QueueCommands(StringView(cmdText, 1), "Immediate", .NoLines);
+						gApp.mScriptManager.QueueCommands(StringView(cmdText, 1), "Immediate", .NoLines | .NoWait); 
 					}
 					}
 					else
 					else
 				    	result = mResultHoverWatch.Eval(cmdText, false);
 				    	result = mResultHoverWatch.Eval(cmdText, false);