Skip to content
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

Allow range to extend past the end of the last line, per LSP spec #9149

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

davidwengier
Copy link
Contributor

Fixes the following exception, reported in https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1868418 (though I couldn't repro it 🤷‍♂️)

[Error - 4:03:22 PM] System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'Range end line 50 matches or exceeds SourceText boundary 50.')
   at Microsoft.AspNetCore.Razor.LanguageServer.Extensions.RangeExtensions.AsRazorTextSpan(Range range, SourceText sourceText) in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/RangeExtensions.cs:line 172
   at Microsoft.AspNetCore.Razor.LanguageServer.Semantic.TagHelperSemanticRangeVisitor.VisitAllNodes(RazorCodeDocument razorCodeDocument, Range range, RazorSemanticTokensLegend razorSemanticTokensLegend, Boolean colorCodeBackground) in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/TagHelperSemanticRangeVisitor.cs:line 40
   at Microsoft.AspNetCore.Razor.LanguageServer.Semantic.RazorSemanticTokensInfoService.GetSemanticTokensAsync(TextDocumentIdentifier textDocumentIdentifier, Range range, VersionedDocumentContext documentContext, RazorSemanticTokensLegend razorSemanticTokensLegend, Guid correlationId, CancellationToken cancellationToken) in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs:line 88
   at Microsoft.AspNetCore.Razor.LanguageServer.Semantic.SemanticTokensRangeEndpoint.HandleRequestAsync(SemanticTokensRangeParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/SemanticTokensRangeEndpoint.cs:line 71
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken)
[Error - 4:03:22 PM] Request textDocument/semanticTokens/range failed.
  Message: Specified argument was out of the range of valid values. (Parameter 'Range end line 50 matches or exceeds SourceText boundary 50.')
  Code: -32000 

@davidwengier davidwengier requested a review from a team as a code owner August 23, 2023 01:21
@davidwengier davidwengier merged commit 004a706 into dotnet:main Aug 23, 2023
12 checks passed
@davidwengier davidwengier deleted the AllowRangePastEOF branch August 23, 2023 21:56
@ghost ghost added this to the Next milestone Aug 23, 2023
@Cosifne Cosifne modified the milestones: Next, 17.8 P3 Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants