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

IntelliJ Support - Gets a Exception in the SemanticTokensHandler.CreateRegistrationOptions #1068

Open
Simonl9l opened this issue Oct 14, 2023 · 0 comments

Comments

@Simonl9l
Copy link

Firstly thanks for maintain this repo, it's a godsend when your underlying DLS tools are implemented in .Net!

It seems that JetBrains now has limited support for LSP Servers based on the IntelliJ platform - albeit the subscription based versions of their tools "ultimate", not community.

Im still very much learning the ropes of the OmniSharp LSP framework, so if Im not connecting dots apologies in advance.

As it stands InteliJ's LSP client implementation does not support syntax highlighting, and my Handler based on SemanticTokensHandlerBase shows an exception when I set up the Legend in the SemanticTokenRegistrationOptions when it tries to access the capability.TokenTypes and capability.TokenModifiers with a System.NullReferenceException.

Am I even doing this correctly, I kinds stole this code from the bicep implementation if I remember?
Is it correct that the InteliJ client should broadcast its capabilities to the LPS server and only supported hander be initialized?
If a client does not do this correctly how do we safely handle these scenarios?

protected override SemanticTokensRegistrationOptions CreateRegistrationOptions(
            SemanticTokensCapability capability, 
            ClientCapabilities clientCapabilities
        )
        {
            return new SemanticTokensRegistrationOptions
            {
                DocumentSelector = TextDocumentSelector.ForLanguage("<my language>"),
                Legend = new SemanticTokensLegend
                {
                    TokenModifiers = capability.TokenModifiers,
                    TokenTypes = capability.TokenTypes
                },
                Full = new SemanticTokensCapabilityRequestFull
                {
                    Delta = false
                },
                Range = true
            };
        }
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

No branches or pull requests

1 participant