razor icon indicating copy to clipboard operation
razor copied to clipboard

Constant Request textDocument/semanticTokens/range failed. error in vscode

Open LiamMorrow opened this issue 1 year ago • 4 comments

G'day, I've been using the c# devkit extension in vscode and have noticed that when editing razor files it constantly shows errors as notifications, simply when navigating to any razor file.

Request textDocument/semanticTokens/range failed. image

Logs

Details [Error - 20:31:23] [LanguageServerHost] System.ArgumentException: Range={ Start={ Line=207, Character=17 }, End={ Line=260, Character=0 } }. text.Length=5758. text.Lines.Count=230 ---> System.ArgumentOutOfRangeException: The requested line number 260 must be less than the number of lines 230. (Parameter 'Line') at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition(LinePosition position) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 67 at Microsoft.CodeAnalysis.Text.TextLineCollection.GetTextSpan(LinePositionSpan span) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 78 at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 287 --- End of inner exception stack trace --- at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 292 at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.ComputeSemanticTokensDataAsync(ClientCapabilities capabilities, Document document, Range[] ranges, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 85 at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(IGlobalOptionService globalOptions, SemanticTokensRefreshQueue semanticTokensRefreshQueue, Range[] ranges, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 50 at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensRangeHandler.HandleRequestAsync(SemanticTokensRangeParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs:line 45 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) [Error - 20:31:23] Request textDocument/semanticTokens/range failed. Message: Range={ Start={ Line=207, Character=17 }, End={ Line=260, Character=0 } }. text.Length=5758. text.Lines.Count=230 Code: -32000 [object Object]

Note this happens on both the current release, and the prerelease.

LiamMorrow avatar Nov 19 '23 10:11 LiamMorrow