@@ -46,6 +46,7 @@ public DebugAdapter(EditorSession editorSession, ChannelBase serverChannel)
46
46
this . editorSession = editorSession ;
47
47
this . editorSession . PowerShellContext . RunspaceChanged += this . powerShellContext_RunspaceChanged ;
48
48
this . editorSession . DebugService . DebuggerStopped += this . DebugService_DebuggerStopped ;
49
+ this . editorSession . PowerShellContext . DebuggerResumed += this . powerShellContext_DebuggerResumed ;
49
50
}
50
51
51
52
public DebugAdapter (
@@ -60,6 +61,7 @@ public DebugAdapter(
60
61
this . editorSession . StartDebugSession ( hostDetails , profilePaths , editorOperations ) ;
61
62
this . editorSession . PowerShellContext . RunspaceChanged += this . powerShellContext_RunspaceChanged ;
62
63
this . editorSession . DebugService . DebuggerStopped += this . DebugService_DebuggerStopped ;
64
+ this . editorSession . PowerShellContext . DebuggerResumed += this . powerShellContext_DebuggerResumed ;
63
65
64
66
// The assumption in this overload is that the debugger
65
67
// is running in UI-hosted mode, no terminal interface
@@ -295,6 +297,11 @@ await this.editorSession.PowerShellContext.ExecuteScriptString(
295
297
"" , false , true ) ;
296
298
}
297
299
300
+ if ( this . editorSession . ConsoleService . EnableConsoleRepl )
301
+ {
302
+ await this . WriteUseIntegratedConsoleMessage ( ) ;
303
+ }
304
+
298
305
// Send the InitializedEvent so that the debugger will continue
299
306
// sending configuration requests
300
307
await this . SendEvent (
@@ -743,23 +750,30 @@ protected async Task HandleEvaluateRequest(
743
750
744
751
if ( isFromRepl )
745
752
{
746
- // Check for special commands
747
- if ( string . Equals ( "!ctrlc" , evaluateParams . Expression , StringComparison . CurrentCultureIgnoreCase ) )
753
+ if ( ! this . editorSession . ConsoleService . EnableConsoleRepl )
748
754
{
749
- editorSession . PowerShellContext . AbortExecution ( ) ;
750
- }
751
- else if ( string . Equals ( "!break" , evaluateParams . Expression , StringComparison . CurrentCultureIgnoreCase ) )
752
- {
753
- editorSession . DebugService . Break ( ) ;
755
+ // Check for special commands
756
+ if ( string . Equals ( "!ctrlc" , evaluateParams . Expression , StringComparison . CurrentCultureIgnoreCase ) )
757
+ {
758
+ editorSession . PowerShellContext . AbortExecution ( ) ;
759
+ }
760
+ else if ( string . Equals ( "!break" , evaluateParams . Expression , StringComparison . CurrentCultureIgnoreCase ) )
761
+ {
762
+ editorSession . DebugService . Break ( ) ;
763
+ }
764
+ else
765
+ {
766
+ // Send the input through the console service
767
+ var notAwaited =
768
+ this . editorSession
769
+ . PowerShellContext
770
+ . ExecuteScriptString ( evaluateParams . Expression , false , true )
771
+ . ConfigureAwait ( false ) ;
772
+ }
754
773
}
755
774
else
756
775
{
757
- // Send the input through the console service
758
- var notAwaited =
759
- this . editorSession
760
- . PowerShellContext
761
- . ExecuteScriptString ( evaluateParams . Expression , false , true )
762
- . ConfigureAwait ( false ) ;
776
+ await this . WriteUseIntegratedConsoleMessage ( ) ;
763
777
}
764
778
}
765
779
else
@@ -770,10 +784,11 @@ protected async Task HandleEvaluateRequest(
770
784
// has been resumed, return an empty result in this case.
771
785
if ( editorSession . PowerShellContext . IsDebuggerStopped )
772
786
{
773
- await editorSession . DebugService . EvaluateExpression (
774
- evaluateParams . Expression ,
775
- evaluateParams . FrameId ,
776
- isFromRepl ) ;
787
+ result =
788
+ await editorSession . DebugService . EvaluateExpression (
789
+ evaluateParams . Expression ,
790
+ evaluateParams . FrameId ,
791
+ isFromRepl ) ;
777
792
}
778
793
779
794
if ( result != null )
@@ -793,6 +808,17 @@ await requestContext.SendResult(
793
808
} ) ;
794
809
}
795
810
811
+ private async Task WriteUseIntegratedConsoleMessage ( )
812
+ {
813
+ await this . SendEvent (
814
+ OutputEvent . Type ,
815
+ new OutputEventBody
816
+ {
817
+ Output = "\n The Debug Console is no longer used for PowerShell debugging. Please use the 'PowerShell Integrated Console' to execute commands in the debugger. Run the 'PowerShell: Show Integrated Console' command to open it." ,
818
+ Category = "stderr"
819
+ } ) ;
820
+ }
821
+
796
822
#endregion
797
823
798
824
#region Event Handlers
@@ -867,6 +893,17 @@ await this.SendEvent<ContinuedEvent>(
867
893
}
868
894
}
869
895
896
+ private async void powerShellContext_DebuggerResumed ( object sender , DebuggerResumeAction e )
897
+ {
898
+ await this . SendEvent (
899
+ ContinuedEvent . Type ,
900
+ new ContinuedEvent
901
+ {
902
+ AllThreadsContinued = true ,
903
+ ThreadId = 1
904
+ } ) ;
905
+ }
906
+
870
907
#endregion
871
908
}
872
909
}
0 commit comments