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

[Python] Regexp backref identifiers #4110

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

michaelblyons
Copy link
Collaborator

@michaelblyons michaelblyons commented Dec 5, 2024

Centralizes named capture group identifiers in a variable. Adds support for capital letters one place they were missing. Adds support for \g<...> backref style.

Relevant documentation in v3.12

Previously included (but now removed) deprecation scopes for non-ASCII capture group identifiers.

Copy link
Collaborator

@deathaxe deathaxe left a comment

Choose a reason for hiding this comment

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

Python always used to try to even correctly highlight py2. Do we need to bother users with deprecated highlighting, really?

@michaelblyons
Copy link
Collaborator Author

I can yank the deprecated highlighting and tests, but there's a real change that is still necessary.

I discovered it trying to name the groups in a capture as specific keys for groupdict().

@deathaxe
Copy link
Collaborator

deathaxe commented Dec 6, 2024

I am fine with required fixes, if current patterns don't match all valid names.

It's just the attempt to do linting by scoping no longer supported nonascii "deprecated". pyright and co. will already highlight them depending on set python version. They should however be highlighted normally by syntax as they are valid in older (even ST's default python versions) - even though actually rather unlikely to appear in real world projects, which is just another reason for not needing that extra complexity.

@deathaxe
Copy link
Collaborator

deathaxe commented Dec 21, 2024

Following example from LaTeXTools would be fixed by this PR.

grafik

@FichteFoll FichteFoll merged commit f615fed into sublimehq:master Jan 8, 2025
1 check passed
@michaelblyons michaelblyons deleted the python/regex-groupdict branch January 8, 2025 15:20
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.

4 participants