Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@felixhao28

Description

@felixhao28
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'),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions