OmniSharp / OmniSharp/csharp-language-server-protocol
IntelliJ Support - Gets a Exception in the SemanticTokensHandler.CreateRegistrationOptions
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 638
- Forks
- 109
- Avg merge
- 1m
- Merged PRs (30d)
- 2
Description
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
};
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the SemanticTokensHandlerBase.CreateRegistrationOptions path and the SemanticTokenRegistrationOptions usage shown in the report, then reproduce the NullReferenceException with an IntelliJ LSP client. Determine how missing semantic-token capabilities are represented and define a safe behavior for that client; done means the scenario no longer throws and supported clients retain semantic-token registration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100