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

Not possible to use language injection on regexes #49

Open
hugopl opened this issue Dec 17, 2024 · 1 comment
Open

Not possible to use language injection on regexes #49

hugopl opened this issue Dec 17, 2024 · 1 comment
Labels
good first issue Good for newcomers

Comments

@hugopl
Copy link
Collaborator

hugopl commented Dec 17, 2024

There's a regex tree-sitter grammar and some other grammar uses it to highlight regular expressions using the tree-sitter injection mechanism.

e.g.: The ruby injection.scm for regexes looks like

(regex
  (string_content) @injection.content
  (#set! injection.language "regex"))

So editors delegate the regex contents highlighting to another parser.

This is not possible yet on Crystal parser because there's just a single regex node that includes the regex delimiters.

@hugopl hugopl added the good first issue Good for newcomers label Dec 17, 2024
@keidax
Copy link
Collaborator

keidax commented Dec 17, 2024

It would be nice to offload the regex syntax details to another grammar. Not entirely clear to me if tree-sitter-regex supports the same set of regex syntax as Crystal: tree-sitter/tree-sitter-regex#41

@hugopl hugopl mentioned this issue Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants