[go: nahoru, domu]

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 support for angle bracket matching and colorization in Typescript #151705

Conversation

liby
Copy link
Contributor
@liby liby commented Jun 10, 2022

This PR fixes #151196

cc @hediet

@hediet
Copy link
Member
hediet commented Jun 27, 2022

This looks good, thank you for the PR! Did you test it / can you post a screenshot?

@liby
Copy link
Contributor Author
liby commented Jun 28, 2022

This looks good, thank you for the PR! Did you test it / can you post a screenshot?

So far this is all I can think of.
image

@liby liby force-pushed the feature/support-angle-bracket-matching-in-typescript branch from 12eb1fb to 4076f61 Compare June 28, 2022 05:20
@hediet
Copy link
Member
hediet commented Jun 28, 2022

Hmm, it should probably also be ignored for jsx elements (return <div></div>;).

@liby liby force-pushed the feature/support-angle-bracket-matching-in-typescript branch from 4076f61 to fac840f Compare June 28, 2022 17:59
@liby
Copy link
Contributor Author
liby commented Jun 28, 2022

Hmm, it should probably also be ignored for jsx elements (return <div></div>;).

It looks like we just need to filter meta.brace.angle and punctuation.definition.tag again.
image

But I feel that this implementation does not seem to work well and there is always the possibility of missing something. Are there other better options? Or use the balancedBracketScopes option to implement a similar whitelist pattern?

Another question is that I'm not sure if the use of "balancedBracketScopes": ["punctuation.definition.typeparameters"], overwrites the currently colorization brackets, and if so, that's a bit tricky.

@hediet
Copy link
Member
hediet commented Jun 29, 2022

Or use the balancedBracketScopes option to implement a similar whitelist pattern?

This would need to allowlist all the cases for (...), {...} and [...] too then... Which might be reasonable though.

Another question is that I'm not sure if the use of "balancedBracketScopes": ["punctuation.definition.typeparameters"], overwrites the currently colorization brackets, and if so, that's a bit tricky.

Yep.

@hediet hediet added this to the July 2022 milestone Jun 29, 2022
@liby
Copy link
Contributor Author
liby commented Jun 29, 2022

This would need to allowlist all the cases for (...), {...} and [...] too then... Which might be reasonable though.

From the description, it is no different from the current solution, only now I'm doing the exclusion method. Then let's continue with the current solution, if you don't have any objections either. 🥰

@hediet
Copy link
Member
hediet commented Jun 29, 2022

I will merge this after the June release, so we have enough time to test this.

@hediet hediet merged commit 72e1767 into microsoft:main Jul 4, 2022
@liby liby deleted the feature/support-angle-bracket-matching-in-typescript branch July 4, 2022 15:53
@github-actions github-actions bot locked and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support <...> bracket matching in TypeScript
3 participants