Skip to content

Commit fd3e521

Browse files
committed
- Added auto-reevaluating watch values on debug step advance
1 parent da93a39 commit fd3e521

File tree

13 files changed

+137
-29
lines changed

13 files changed

+137
-29
lines changed
0 Bytes
Binary file not shown.

src/CSScriptIntellisense/CSharpIntellisense/CSScriptLibrary.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
512 Bytes
Binary file not shown.

src/CSScriptIntellisense/Plugin.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,8 @@ static void ShowSuggestionList(bool snippetsOnly, bool memberInfoWasShowing = fa
883883
{
884884
IEnumerable<ICompletionData> items;
885885

886+
bool cssSugesstion = false;
887+
886888
if (snippetsOnly)
887889
{
888890
items = GetSnippetsItems();
@@ -894,7 +896,7 @@ static void ShowSuggestionList(bool snippetsOnly, bool memberInfoWasShowing = fa
894896
bool namespaceSuggestion = items.All(x => x.CompletionType == CompletionType._namespace);
895897

896898
Point point;
897-
document.GetWordAtCursor(out point);
899+
var word = document.GetWordAtCursor(out point);
898900
int wordStartPos = point.X;
899901

900902
string textOnLeft = document.TextBeforePosition(wordStartPos, 300);
@@ -904,7 +906,14 @@ static void ShowSuggestionList(bool snippetsOnly, bool memberInfoWasShowing = fa
904906

905907
if (!memberSugesstion && !namespaceSuggestion && !assignmentSugesstion)
906908
{
907-
bool cssSugesstion = textOnLeft.Split('\n').Last().TrimStart().StartsWith("//css_");
909+
cssSugesstion = textOnLeft.Split('\n').Last().TrimStart().StartsWith("//css_");
910+
911+
if (!cssSugesstion)
912+
{
913+
if (textOnLeft == "//" && word.StartsWith("css_"))
914+
cssSugesstion = true;
915+
}
916+
908917
if (!cssSugesstion)
909918
{
910919
bool usingSuggestion = document.GetCurrentLine().Trim() == "using";
@@ -973,7 +982,11 @@ static void OnAutocompletionAccepted(ICompletionData data, bool snippetsOnlyMode
973982

974983
if (word != "") // e.g. Console.Wr| but not Console.|
975984
{
976-
document.SetSelection(p.X, p.Y);
985+
string textOnLeft = document.TextBeforePosition(p.X, 300);
986+
if (textOnLeft.EndsWith("//") && word.StartsWith("css_"))
987+
document.SetSelection(p.X - 2, p.Y);
988+
else
989+
document.SetSelection(p.X, p.Y);
977990
}
978991
else
979992
{

src/CSScriptNpp/CSScriptNpp/CSScriptHelper.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,20 @@ static string NppScriptsDir
134134
}
135135
}
136136

137-
static public void Build(string scriptFile)
137+
static public string Build(string scriptFile, Action<string> onCompilerOutput)
138138
{
139139
string compilerOutput;
140-
bool success = Build(scriptFile, out compilerOutput);
140+
bool success = Build(scriptFile, out compilerOutput, onCompilerOutput);
141141
if (!success)
142142
throw new ApplicationException(compilerOutput.RemoveNonUserCompilingInfo());
143+
144+
return compilerOutput;
143145
}
144146

145147
static public string[] GetCodeCompileOutput(string scriptFile)
146148
{
147149
string compilerOutput;
148-
bool success = Build(scriptFile, out compilerOutput);
150+
bool success = Build(scriptFile, out compilerOutput, null);
149151
if (!success)
150152
return compilerOutput.RemoveNonUserCompilingInfo().Split('\n');
151153
else
@@ -288,7 +290,7 @@ internal static string cscs_v35_exe
288290
}
289291
}
290292

291-
static bool Build(string scriptFile, out string compilerOutput)
293+
static bool Build(string scriptFile, out string compilerOutput, Action<string> onCompilerOutput)
292294
{
293295
string oldNotificationMessage = null;
294296
try
@@ -309,10 +311,16 @@ static bool Build(string scriptFile, out string compilerOutput)
309311
var output = new StringBuilder();
310312

311313
bool error = false;
314+
bool printOutput = false;
312315
string line = null;
313316
while (null != (line = p.StandardOutput.ReadLine()))
314317
{
315-
if (line.Contains("NuGet") && NotifyClient != null)
318+
printOutput = printOutput || line.Contains("NuGet");
319+
320+
if (printOutput && onCompilerOutput != null)
321+
onCompilerOutput(line);
322+
323+
if (line.Contains("NuGet") && NotifyClient != null && !oldNotificationMessage.HasText())
316324
{
317325
oldNotificationMessage = NotifyClient("Processing NuGet packages...");
318326
}
0 Bytes
Binary file not shown.

src/CSScriptNpp/CSScriptNpp/CSScriptLibrary.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/CSScriptNpp/CSScriptNpp/MDbg/Debugger.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,8 @@ private static void OnInvokeComplete(string notification)
526526
private static int stepsCount = 0;
527527
private static bool resumeOnNextBreakPoint = false;
528528

529+
public static bool readyForEvaluation = false;
530+
529531
private static void HandleNotification(string notification)
530532
{
531533
//process=>7924:STARTED
@@ -575,10 +577,13 @@ private static void HandleNotification(string notification)
575577
//By default Mdbg always enters break mode at start/attach completed
576578
//however we should only resume after mdbg finished the initialization (first break is reported).
577579
resumeOnNextBreakPoint = true;
580+
581+
readyForEvaluation = true;
578582
}
579583
else if (message.EndsWith(":ENDED"))
580584
{
581585
NotifyOnDebugStepChanges();
586+
readyForEvaluation = false;
582587
}
583588
}
584589
else if (message.StartsWith(NppCategory.BreakEntered))
@@ -1155,6 +1160,7 @@ static public void Start(string app, string args, CpuType cpu)
11551160
{
11561161
if (!IsRunning)
11571162
{
1163+
readyForEvaluation = true; // there will be no "process started" message so do it immediately
11581164
lastLocation = null;
11591165
Start(cpu);
11601166

src/CSScriptNpp/CSScriptNpp/MDbg/DebuggerServer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ static public int DebuggerProcessId
204204

205205
static public event Action OnDebuggerStateChanged; //breakpoint, step advance, process exit
206206

207-
static protected Action OnBreak; //breakpoint hit
208-
static protected Action<string> OnDebuggeeProcessNotification; //debugger process state change
207+
static public Action OnBreak; //breakpoint hit
208+
static public Action<string> OnDebuggeeProcessNotification; //debugger process state change
209209

210210
/// <summary>
211211
/// Initializes this instance.

src/CSScriptNpp/Dialogs/DebugObjectsPanel.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,9 @@ int GetColumnStartOffset(int index)
4545
if (columnsStartOffset.ContainsKey(index))
4646
return columnsStartOffset[index];
4747
return -1;
48-
//int retval = 0;
49-
50-
//for (int i = 0; i < index; i++)
51-
// retval += listView1.Columns[i].Width;
52-
53-
//return retval;
5448
}
5549

50+
5651
void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
5752
{
5853
focucedItem = listView1.GetItemAt(e.X, e.Y);
@@ -72,6 +67,15 @@ void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
7267
}
7368
}
7469

70+
public DbgObject[] GetItems()
71+
{
72+
return listView1.Items
73+
.OfType<ListViewItem>()
74+
.Select(x=>x.Tag)
75+
.OfType<DbgObject>()
76+
.ToArray();
77+
}
78+
7579
void StartEditing(ListViewItem item, int subItem)
7680
{
7781
int spos = 0;

0 commit comments

Comments
 (0)