Skip to content

✨ Injected Languages #16

Closed
Closed

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

Activity

  1. austincondiff commented on Jun 17, 2022

    @austincondiff
    Collaborator

    Good point. I can also see this being useful when writing regex or jsx in javascript.

  2. changed the title [-]Injected Languages[/-] [+]✨ Injected Languages[/+] on Jun 24, 2022
  3. pinned this issue on Oct 4, 2022
  4. moved this from 🆕 New to 🏃‍♂️ In Progress in CodeEdit Projecton Feb 16, 2023
  5. added a commit that references this issue on Mar 24, 2023
  6. moved this from 🏃‍♂️ In Progress to 🏁 Complete in CodeEdit Projecton Mar 24, 2023
  7. unpinned this issue on Apr 5, 2023
  8. added a commit that references this issue on Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions