Skip to content

✨ Injected Languages #16

@lukepistrol

Description

@lukepistrol

Injected languages are important for languages like HTML which might embed CSS or JavaScript code blocks.

Example Use Cases

  • HTML implements CSS, JavaScript
  • JavaScript implements regex, jsdoc, HTML/React

Injections.scm

Some grammars that support injections have an additional injections.scm file in their queries folder.

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.

Resources

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

Status

🏁 Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions