Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Multiline strings and comments break semantic highlights #2597

Open
silvercircle opened this issue Jan 23, 2024 · 0 comments
Open

Multiline strings and comments break semantic highlights #2597

silvercircle opened this issue Jan 23, 2024 · 0 comments

Comments

@silvercircle
Copy link

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.SemanticTokensDeltaPipeline2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\n at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\n at MediatR.Pipeline.RequestPreProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\n at MediatR.Pipeline.RequestPostProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\n at MediatR.Pipeline.RequestExceptionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\n at MediatR.Pipeline.RequestExceptionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\n at MediatR.Pipeline.RequestExceptionActionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\n at MediatR.Pipeline.RequestExceptionActionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 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.RequestRouterBase1.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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant