Skip to content

Remove extra prompt string added to interactive debugging session #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ public class DebugAdapter : DebugAdapterBase
private OutputDebouncer outputDebouncer;

private bool noDebug;
private string arguments;
private bool isRemoteAttach;
private bool isAttachSession;
private bool waitingForAttach;
private string scriptToLaunch;
private bool enableConsoleRepl;
private bool ownsEditorSession;
private bool executionCompleted;
private string arguments;
private bool isInteractiveDebugSession;
private RequestContext<object> disconnectRequestContext = null;

public DebugAdapter(HostDetails hostDetails, ProfilePaths profilePaths)
Expand Down Expand Up @@ -303,13 +304,9 @@ protected async Task HandleLaunchRequest(

await requestContext.SendResult(null);

// If no script is being launched, execute an empty script to
// cause the prompt string to be evaluated and displayed
if (string.IsNullOrEmpty(this.scriptToLaunch))
{
await this.editorSession.PowerShellContext.ExecuteScriptString(
"", false, true);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what do we miss out on during an interactive session debug by not having the above code? An initial prompt string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prompt has already been written by this point, so this line is totally pointless now. It was necessary before the integrated console came along because a prompt was never displayed at first when the debugger starts, the assumption was that we were launching a script. For an "interactive session" I needed to invoke a prompt to display, so this was a hacky way to do that :)

// If no script is being launched, mark this as an interactive
// debugging session
this.isInteractiveDebugSession = string.IsNullOrEmpty(this.scriptToLaunch);

if (this.editorSession.ConsoleService.EnableConsoleRepl)
{
Expand Down Expand Up @@ -447,6 +444,11 @@ protected async Task HandleDisconnectRequest(
{
this.disconnectRequestContext = requestContext;
this.editorSession.PowerShellContext.AbortExecution();

if (this.isInteractiveDebugSession)
{
await this.OnExecutionCompleted(null);
}
}
else
{
Expand Down