atom / language-python

Python package for Atom
Other
190 stars 146 forks source link

Add injectionRegex to the tree-sitter grammar #314

Open eugmes opened 4 years ago

eugmes commented 4 years ago

This allows to use this grammar from other tree-sitter grammars.

See also: https://github.com/atom/atom/pull/17551

Requirements

Description of the Change

This change adds injectionRegex regex key into tree-sitter-python.cson. Other grammars will be able to inject python grammar by specifying language py or anything that contains Python or python.

Alternate Designs

I don't know about any other alternatives.

Benefits

This will allow to use python grammar from other language packages that use tree-sitter. I'm developing https://github.com/eugmes/language-coccinelle that will benefit from this feature.

Possible Drawbacks

The grammar can be injected instead of some other grammar that uses similar injection regex. But I think that the proposed regex is specific enough to not cause many problems.

Applicable Issues

None?