Closed lukepistrol closed 1 year ago
Injected languages are important for languages like HTML which might embed CSS or JavaScript code blocks.
HTML
CSS
JavaScript
regex
jsdoc
HTML/React
Some grammars that support injections have an additional injections.scm file in their queries folder.
injections.scm
queries
An example is tree-sitter-html:
((script_element (raw_text) @injection.content) (#set! injection.language "javascript")) ((style_element (raw_text) @injection.content) (#set! injection.language "css"))
We need to figure out how to parse and load the associated injected languages in addition to the base language itself.
Good point. I can also see this being useful when writing regex or jsx in javascript.
Injected languages are important for languages like
HTML
which might embedCSS
orJavaScript
code blocks.Example Use Cases
HTML
implementsCSS
,JavaScript
JavaScript
implementsregex
,jsdoc
,HTML/React
Injections.scm
Some grammars that support injections have an additional
injections.scm
file in theirqueries
folder.An example is tree-sitter-html:
We need to figure out how to parse and load the associated injected languages in addition to the base language itself.
Resources