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

Typescript: Name.Other over extends to punctuation in function definition #1510

Closed
felixhao28 opened this issue Aug 15, 2020 · 1 comment
Closed
Milestone

Comments

@felixhao28
Copy link
Contributor

@felixhao28 felixhao28 commented Aug 15, 2020

async function main() {
}

The above code produces this in Pygments 2.6.1:

image

The issue is caused by https://github.com/pygments/pygments/blob/master/pygments/lexers/javascript.py#L511

            # Match stuff like: function() {...}
            (r'([a-zA-Z_?.$][\w?.$]*)\(\) \{', Name.Other, 'slashstartsregex'),

which tags the () { as Name.Other. So I suggest change it to

            # Match stuff like: function() {...}
            (r'([a-zA-Z_?.$][\w?.$]*)(?=\(\) \{)', Name.Other, 'slashstartsregex'),
@felixhao28
Copy link
Contributor Author

@felixhao28 felixhao28 commented Aug 15, 2020

I submitted a pr for this.

@Anteru Anteru closed this in #1511 Jan 4, 2021
@Anteru Anteru added this to the 2.7.4 milestone Jan 4, 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
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants