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

Use core LSP TokenTypes where possible and validate token names #2548

Merged
merged 1 commit into from
Jul 2, 2023

Conversation

JoeRobich
Copy link
Member

Closes #2483

  • Adds LSP SemanticTokensHandler tests.

// Use Core LSP token types where possible
value => _coreTokenMap.ContainsKey(value)
? _coreTokenMap[value]
: new SemanticTokenType(MakeLSPCompatibleString(value.ToString())));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we had been using the Roslyn ClassificationTypeName which contained spaces. This changes us to use LSP TokenTypes when possible, otherwise SemanticHighlightClassification EnumMember names fixed up to begin with a lowercase letter.

private readonly Mef.IRequestHandler<SemanticHighlightRequest, SemanticHighlightResponse> _definitionHandler;
private readonly DocumentSelector _documentSelector;

private static string MakeLSPCompatibleString(string str)
=> char.ToLower(str[0]) + str.Substring(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
=> char.ToLower(str[0]) + str.Substring(1);
=> char.ToLower(str[0]) + str[1..];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will also say that I spent a minute trying to figure out if there was a way to do this in one simple line without doing a substring at all, using spans, but I would have to make a local out of char.ToLower(str[0]) to get that to work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have to pull in Range to make your suggestion work for net472. Maybe we can clean this all up one day.

@JoeRobich JoeRobich merged commit 06fb372 into OmniSharp:master Jul 2, 2023
@JustALawnGnome7
Copy link

Very exciting! Any idea when we should expect this change to be included in a future OmniSharp release, or which release version will include the change?

@333fred
Copy link
Contributor

333fred commented Jul 10, 2023

The next version will include it, but we don't have a regular release schedule. It's usually whenever there's something requiring a bugfix release.

@SvanRaaij
Copy link

Isn't "making sure the software works out of the box again for nvim users" a reason for a bugfix release?

@333fred
Copy link
Contributor

333fred commented Jul 14, 2023

That seems reasonable. @dibarbet, do you think we do a release?

@jsomedon
Copy link

Please do release, I have been constantly seeing my neovim reporting Invalid character in group name, and I am sure many users been noticing this too.

@333fred
Copy link
Contributor

333fred commented Jul 17, 2023

Thanks to @JoeRobich, 1.39.8 with this fix was released just now: https://github.com/OmniSharp/omnisharp-roslyn/releases/tag/v1.39.8

B3RR10 added a commit to B3RR10/dotfiles that referenced this pull request Oct 2, 2024
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

Successfully merging this pull request may close these issues.

Semantic tokens do not conform to the LSP specification
5 participants