@@ -28,12 +28,13 @@ internal sealed class ValidateBreakableRangeHandler() : ILspServiceDocumentReque
2828 public TextDocumentIdentifier GetTextDocumentIdentifier ( LSP . VSInternalValidateBreakableRangeParams request )
2929 => request . TextDocument ;
3030
31- public async Task < LSP . Range ? > HandleRequestAsync ( LSP . VSInternalValidateBreakableRangeParams request , RequestContext context , CancellationToken cancellationToken )
32- {
33- var document = context . GetRequiredDocument ( ) ;
31+ public Task < LSP . Range ? > HandleRequestAsync ( LSP . VSInternalValidateBreakableRangeParams request , RequestContext context , CancellationToken cancellationToken )
32+ => GetBreakableRangeAsync ( context . GetRequiredDocument ( ) , request . Range , cancellationToken ) ;
3433
34+ public static async Task < LSP . Range ? > GetBreakableRangeAsync ( Document document , LSP . Range range , CancellationToken cancellationToken )
35+ {
3536 var text = await document . GetValueTextAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
36- var span = ProtocolConversions . RangeToTextSpan ( request . Range , text ) ;
37+ var span = ProtocolConversions . RangeToTextSpan ( range , text ) ;
3738 var breakpointService = document . Project . Services . GetRequiredService < IBreakpointResolutionService > ( ) ;
3839
3940 if ( span . Length > 0 )
@@ -62,7 +63,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(LSP.VSInternalValidateBr
6263 if ( tree . GetDiagnostics ( cancellationToken ) . Any ( d => d . Severity == DiagnosticSeverity . Error ) )
6364 {
6465 // Keep the span as is.
65- return request . Range ;
66+ return range ;
6667 }
6768 }
6869 }
@@ -93,7 +94,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(LSP.VSInternalValidateBr
9394 // BP: int a = $$ GetData();
9495 //
9596 // If the user types "1;" we'd shrink the breakpoint, so stick to the end of the range.
96- if ( ! result . IsLineBreakpoint && BreakpointRangeIsSmaller ( breakpointRange , request . Range ) )
97+ if ( ! result . IsLineBreakpoint && BreakpointRangeIsSmaller ( breakpointRange , range ) )
9798 {
9899 var secondResult = await breakpointService . ResolveBreakpointAsync ( document , new TextSpan ( span . End , length : 0 ) , cancellationToken ) . ConfigureAwait ( false ) ;
99100 if ( secondResult is not null )
0 commit comments