Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Add support for python2/3 shebangs in tree-sitter grammar #296
Description of the Change
I add shebang lines atop all my Python files. If I use
This PR updates the
Consistent syntax highlighting and the benefits of tree-sitter across more types of Python files (i.e. with or without the "versioned" shebang).
I know the tree-sitter grammar still lacks some highlighting compared to the first-mate grammar, which may make it undesirable to apply more broadly. I plan to submit a few more PRs soon to resolve some of these issues (e.g. tokenizing function parameter names). However, I still think the tree-sitter grammar, for all of its benefits, is worthy of adopting more broadly despite these minor issues (at least those few I've noticed).
Apr 7, 2019
referenced this pull request
Apr 12, 2019
xax left a comment •
@caleb531: Acknowledging you didn't invent this patricular firstLineRegex, nevertheless the period "." inside brackets "[…]" in the regular expression need not (and should not) be escaped by a backslash "".