Skip to content

Conversation

aoitaku
Copy link

@aoitaku aoitaku commented May 20, 2025

Hi team,

I've noticed that parentheses within character classes (charclass) are breaking the bracket pairing feature in VS Code.

VS Code's bracket pairing logic is designed to ignore parentheses that appear within certain scopes, such as strings (where they often appear individually and unmatched), to prevent incorrect pairing.
However, the current scope name for charclass is declaration.keyword.peggy, which is not treated as a string-like scope. This causes the bracket pairing to malfunction when parentheses are used inside character classes.

To address this, I propose changing the scope name for charclass from declaration.keyword.peggy to string.regex.peggy.
This change should allow VS Code to correctly interpret parentheses within character classes, thereby fixing the bracket pairing issue.

Please let me know your thoughts on this proposal.

Before

スクリーンショット 2025-05-20 162941

After

スクリーンショット 2025-05-20 183214

Thanks,
aoitaku

@hildjj
Copy link
Contributor

hildjj commented May 20, 2025

Can you please test with variations of the new Unicode classes as well?

a = [\p{ASCII}]
b = [a-\u{ffff}]u

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.

2 participants