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

Add semantic token type 'constructor' #1514

Closed
wants to merge 1 commit into from

Conversation

0dinD
Copy link
Contributor

@0dinD 0dinD commented Jul 22, 2020

This PR adds a more specific token type for constructors, called constructor, which will allow constructors to be colored differently from methods, if desired. I could submit a PR to vscode-java, similar to redhat-developer/vscode-java#1540, which would allow method to be the supertype of constructor, in order to avoid breaking current color themes.

Unfortunately, I encountered a problem whilst implementing this: when a VS Code client receives a constructor token, the semantic highlighting completely breaks for that file. After some debugging, I found out that it was a bug in VS Code, so I have submitted an issue (microsoft/vscode#103104) about that. Until that gets fixed, this PR is not ready to be merged.

@0dinD
Copy link
Contributor Author

0dinD commented Sep 5, 2020

microsoft/vscode#103104 has been fixed in VS Code Insiders now, and will probably release in VS Code 1.49, at which point this PR would be ready to merge as long as vscode-java declares 1.49 as the minimum version.

But while working on #1539, I realized that we could also provide the same feature by adding a constructor modifier and making the token type of constructors class, interface, enum etc instead of function.

This would give even more flexibility in styling constructors than a constructor token type. For example, you could choose between styling them exactly like their respective types or styling them like methods, with a selector like *.constructor.

The only downside that I can see is that we change the token type of constructors from function to class, interface, enum etc, which would break color themes that don't update to also specify *.constructor.

@fbricon what do you think? Should constructor be a token type or a modifier to class, interface, enum etc?

@0dinD
Copy link
Contributor Author

0dinD commented Sep 16, 2020

Closing after discussion with Eskibear.

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.

1 participant