alex-pinkus / tree-sitter-swift

A tree-sitter grammar for the Swift programming language.
MIT License
137 stars 35 forks source link

Add injections for regex highlighting. #384

Closed patrickt closed 6 months ago

patrickt commented 6 months ago

This will allow components of regexen to be highlighted on GitHub, in the manner of those in JS and Ruby.

alex-pinkus commented 6 months ago

Neat!

jtbandes commented 6 months ago

👀 Curious if this means it is calling out to a common regex grammar shared across other languages – or is there an opportunity to customize it for Swift? Swift has chosen to implement a (very extensive) superset of several regex dialects, and properly highlighting all these features may be a journey! (even Xcode does not yet do it 😄)

patrickt commented 6 months ago

@jtbandes Yes, this calls out to the highlighting specified in https://github.com/tree-sitter/tree-sitter-regex. It sounds like we might need to augment some of its capabilities to match Swift’s new stuff.