Skip to content

Commit bf485ff

Browse files
committed
Fix #130: Reduce prompt noise in debug adapter
This change keeps the debug adapter from printing the prompt until the user enters a command. This will allow breakpoints to be hit without the prompt being shown every time. The change also trims the ending '>' character off of the end of the prompt to reduce user confusion about where commands should be typed.
1 parent 2bdf4bf commit bf485ff

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/PowerShellEditorServices/Session/PowerShellContext.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -905,10 +905,15 @@ private void WritePromptToHost(Func<PSCommand, string> invokeAction)
905905
Environment.NewLine,
906906
false);
907907

908+
// Trim the '>' off the end of the prompt string to reduce
909+
// user confusion about where they can type.
910+
// TODO: Eventually put this behind a setting, #133
911+
promptString = promptString.TrimEnd(' ', '>', '\r', '\n');
912+
908913
// Write the prompt string
909914
this.WriteOutput(
910915
promptString,
911-
false);
916+
true);
912917
}
913918

914919
private void WritePromptWithRunspace(Runspace runspace)
@@ -974,7 +979,8 @@ private void OnDebuggerStop(object sender, DebuggerStopEventArgs e)
974979
null));
975980

976981
// Write out the debugger prompt
977-
this.WritePromptWithNestedPipeline();
982+
// TODO: Eventually re-enable this and put it behind a setting, #133
983+
//this.WritePromptWithNestedPipeline();
978984

979985
// Raise the event for the debugger service
980986
if (this.DebuggerStop != null)

test/PowerShellEditorServices.Test/Console/ConsoleServiceTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ await this.powerShellContext.ExecuteScriptString(
7979
new string[] { Environment.NewLine },
8080
StringSplitOptions.None);
8181

82-
// The output should be 3 lines: the expected string,
83-
// an empty line, and the prompt string.
84-
Assert.Equal(3, normalOutputLines.Length);
82+
// The output should be 4 lines: the expected string, an
83+
// empty line, the prompt string, and another empty line.
84+
Assert.Equal(4, normalOutputLines.Length);
8585
Assert.Equal(
8686
TestOutputString,
8787
normalOutputLines[0]);

0 commit comments

Comments
 (0)