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

Improved Regex syntax highlighting #4902

Merged
merged 4 commits into from
Dec 16, 2021
Merged

Improved Regex syntax highlighting #4902

merged 4 commits into from
Dec 16, 2021

Conversation

TechPizzaDev
Copy link
Contributor

Improves semantic highlighting of regex by utilizing Roslyn data that was previously unused.
This "breaks" themes that only style the regexp token because new specialized token types were added.

@333fred
Copy link
Member

333fred commented Nov 18, 2021

Could you add some screenshots to demonstrate what this looks like?

@TechPizzaDev
Copy link
Contributor Author

Here are some examples within VSCode with default colors from Visual Studio 2019.

VSCode Light:
image

VS2022 Light:
image

VSCode Dark:
image

VS2022 Dark:
image

@JoeRobich
Copy link
Member

@TechnologicalPizza Thanks so much for adding these tokens. I think we are missing two things to make this complete.

  1. For the other token types, we maintain entries in the package.json where we map each token type to a textmate scope to aid in theming.

https://github.com/OmniSharp/omnisharp-vscode/blob/675319476db5713da3e45f6879b0eda44b1863a5/package.json#L3664-L3739

  1. We also ship semantic enabled Visual Studio 2019 themes that could be updated to better match the VS 2019/2022 regex colors. (see https://github.com/OmniSharp/omnisharp-vscode/tree/master/themes)

If you feel up to working on these two tasks, please let me know. Otherwise, I am happy to take this PR as is.

@TechPizzaDev
Copy link
Contributor Author

Seems like something interesting I could look at 👀
I'm not really sure what name should go where but I'll investigate a bit first.

@JoeRobich
Copy link
Member

JoeRobich commented Nov 18, 2021

I'm not really sure what name should go where but I'll investigate a bit first.

Some are already defined in the themes. Others will have to be a best guess unless you find something definitive.

https://github.com/OmniSharp/omnisharp-vscode/blob/675319476db5713da3e45f6879b0eda44b1863a5/themes/vs2019_light.json#L543-L583

@TechPizzaDev
Copy link
Contributor Author

With commit cba7893 these are the default colors that were already in vs2019_dark.json🥳
image

@JoeRobich
Copy link
Member

@TechnologicalPizza Sorry I haven't followed up. Were there any required changes to the Light theme?

@TechPizzaDev
Copy link
Contributor Author

@JoeRobich I don't think so? The images I uploaded were made with stock themes. This PR doesn't change any themes either.
I couldn't really figure out why the Light theme was brighter though. It seemed to use the same color definitions as the Dark theme but it was somehow brightened by VSCode, unless I missed some specific regex stuff in some light theme somewhere.

@JoeRobich
Copy link
Member

Thanks @TechnologicalPizza !

@JoeRobich JoeRobich merged commit dcae1fb into dotnet:master Dec 16, 2021
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.

3 participants