Multiline strings and comments break semantic highlights
silvercircle opened this issue · 0 comments
Whenever I use either a multiline string or a comment starting with /*
and spanning multiple lines, semantic tokens are disabled for the entire file and OmniSharp responds with the following error message in the log:
[ERROR][2024-01-23 10:30:40] ...lsp/handlers.lua:573 "OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Failed to handle request textDocument/semanticTokens/full 44 - System.ArgumentOutOfRangeException: Range must not span multiple lines (Parameter 'range')\n at OmniSharp.Extensions.LanguageServer.Protocol.Document.SemanticTokensBuilder.Push(Range range, Int32 tokenType, Int32 tokenModifiers)\n at OmniSharp.LanguageServerProtocol.Handlers.OmniSharpSemanticTokensHandler.Tokenize(SemanticTokensBuilder builder, ITextDocumentIdentifierParams identifier, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpSemanticTokensHandler.cs:line 97\n at OmniSharp.Extensions.LanguageServer.Protocol.Document.SemanticTokensHandlerBase.Handle(SemanticTokensParams request, CancellationToken cancellationToken)\n at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)\n at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)\n at MediatR.Pipeline.RequestPreProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)\n at MediatR.Pipeline.RequestPostProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)\n at MediatR.Pipeline.RequestExceptionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)\n at MediatR.Pipeline.RequestExceptionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)\n at MediatR.Pipeline.RequestExceptionActionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)\n at MediatR.Pipeline.RequestExceptionActionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)\n at OmniSharp.Extensions.JsonRpc.RequestRouterBase1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)\n at OmniSharp.Extensions.JsonRpc.RequestRouterBase
1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)\n at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<b__5>d.MoveNext() | Method='textDocument/semanticTokens/full' RequestId='44'"
A simple
public class Program
{
public string name = "test";
public string multiline = @"a simple multiline
string";
}
is enough to trigger the error message.
The same happens when using a comment like:
/*
* comment...
*/
It does NOT happen when using double or triple asterisks like:
/**
* comment...
*/
Omnisharp was invoked with the following command:
/home/alex/.local/share/nvim/omnisharp/OmniSharp -z
-s /data/projects/csw --hostPID 751396
DotNet:enablePackageRestore=true --encoding utf-8 --languageserver
csharp.semanticHighlighting.enabled=true
FormattingOptions:EnableEditorConfigSupport=true
RoslynExtensionsOptions:EnableAnalyzersSupport=true
Sdk:IncludePrereleases=true
RoslynExtensionsOptions:EnableDecompilationSupport=true
.NET is 8.0.101
on Fedora Linux.