File tree 3 files changed +5
-20
lines changed
src/PowerShellEditorServices/Services/DebugAdapter
3 files changed +5
-20
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,8 @@ public async Task RemoveBreakpointsAsync(IEnumerable<Breakpoint> breakpoints)
281
281
bps . Remove ( lineBreakpoint ) ;
282
282
}
283
283
break ;
284
+ default :
285
+ throw new ArgumentException ( "Unsupported breakpoint type." ) ;
284
286
}
285
287
}
286
288
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ public async Task<BreakpointDetails[]> SetLineBreakpointsAsync(
185
185
{
186
186
if ( clearExisting )
187
187
{
188
- await this . ClearBreakpointsInFileAsync ( scriptFile ) . ConfigureAwait ( false ) ;
188
+ await _breakpointService . RemoveAllBreakpointsAsync ( scriptFile . FilePath ) . ConfigureAwait ( false ) ;
189
189
}
190
190
191
191
return ( await _breakpointService . SetBreakpointsAsync ( escapedScriptPath , breakpoints ) . ConfigureAwait ( false ) ) . ToArray ( ) ;
@@ -665,23 +665,6 @@ public VariableScope[] GetVariableScopes(int stackFrameId)
665
665
666
666
#region Private Methods
667
667
668
- private async Task ClearBreakpointsInFileAsync ( ScriptFile scriptFile )
669
- {
670
- // Get the list of breakpoints for this file
671
- // if (_breakpointService.BreakpointsPerFile.TryGetValue(scriptFile.Id, out HashSet<Breakpoint> breakpoints))
672
- // {
673
- // if (breakpoints.Count > 0)
674
- // {
675
- await _breakpointService . RemoveAllBreakpointsAsync ( scriptFile . FilePath ) . ConfigureAwait ( false ) ;
676
- // await _breakpointService.RemoveBreakpointsAsync((await _breakpointService.GetBreakpointsAsync())
677
- // .Where(bp => bp is LineBreakpoint lbp && string.Equals(lbp.Script, scriptFile.FilePath))).ConfigureAwait(false);
678
-
679
- // Clear the existing breakpoints list for the file
680
- // breakpoints.Clear();
681
- // }
682
- // }
683
- }
684
-
685
668
private async Task FetchStackFramesAndVariablesAsync ( string scriptNameOverride )
686
669
{
687
670
await this . debugInfoHandle . WaitAsync ( ) . ConfigureAwait ( false ) ;
Original file line number Diff line number Diff line change @@ -142,11 +142,12 @@ public SetBreakpointsHandler(
142
142
public async Task < SetBreakpointsResponse > Handle ( SetBreakpointsArguments request , CancellationToken cancellationToken )
143
143
{
144
144
ScriptFile scriptFile = null ;
145
+ bool isUntitledPath = ScriptFile . IsUntitledPath ( request . Source . Path ) ;
145
146
146
147
// When you set a breakpoint in the right pane of a Git diff window on a PS1 file,
147
148
// the Source.Path comes through as Untitled-X. That's why we check for IsUntitledPath.
148
149
if ( ! _workspaceService . TryGetFile ( request . Source . Path , out scriptFile ) &&
149
- ! ScriptFile . IsUntitledPath ( request . Source . Path ) )
150
+ ! isUntitledPath )
150
151
{
151
152
string message = _debugStateService . NoDebug ? string . Empty : "Source file could not be accessed, breakpoint not set." ;
152
153
var srcBreakpoints = request . Breakpoints
@@ -162,7 +163,6 @@ public async Task<SetBreakpointsResponse> Handle(SetBreakpointsArguments request
162
163
163
164
// Verify source file is a PowerShell script file.
164
165
string fileExtension = Path . GetExtension ( scriptFile ? . FilePath ?? "" ) ? . ToLower ( ) ;
165
- bool isUntitledPath = ScriptFile . IsUntitledPath ( request . Source . Path ) ;
166
166
if ( ( ! isUntitledPath && fileExtension != ".ps1" && fileExtension != ".psm1" ) ||
167
167
( ! BreakpointApiUtils . SupportsBreakpointApis && isUntitledPath ) )
168
168
{
You can’t perform that action at this time.
0 commit comments