Skip to content

feat(languages): support static injections and scalable pack validation - #176

Merged
fcoury-oai merged 1 commit into
masterfrom
fcoury/arborium-language-support
Aug 5, 2026
Merged

feat(languages): support static injections and scalable pack validation#176
fcoury-oai merged 1 commit into
masterfrom
fcoury/arborium-language-support

Conversation

@fcoury-oai

@fcoury-oai fcoury-oai commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Arborium-backed language packs commonly describe embedded languages with static Tree-sitter query properties, but Red previously recognized only dynamic language captures. Red also rebuilt and revalidated the entire language registry after accepting every language definition, making startup and reload increasingly expensive as the pack catalog grows.

This change prepares the editor for independently installed Arborium-backed packs:

  • Honor (#set! injection.language "...") while preserving existing dynamic captures and giving explicitly configured static languages deterministic precedence.
  • Keep injected languages optional: missing grammars are skipped, and opening one pack never installs or approves another pack.
  • Validate language definitions incrementally so previously accepted native grammars are not reopened, rehashed, and recompiled for every subsequent definition.
  • Preserve per-language quarantine: a broken definition does not remove earlier or later valid languages.
  • Update language-pack documentation and the distribution decision to reflect the existing catalog, independent package lifecycle, and source-only Arborium architecture.

Companion language-pack importer: codersauce/red-language-packs#1.

How to Test

  1. Run cargo test --lib highlighter::tests::static_injection_properties_highlight_available_nested_source and confirm statically selected JavaScript receives syntax highlighting inside Markdown.
  2. Run cargo test --lib highlighter::tests::dynamic_tree_sitter_injection_captures_remain_supported and confirm existing dynamically selected fenced languages remain unchanged.
  3. Run cargo test --lib language::tests::invalid_language_does_not_remove_previously_or_subsequently_accepted_languages and confirm only the invalid definition is quarantined.
  4. Install the companion Go and Swift packs with explicit --trust-native-grammars, then run red --check-config; both independent languages should load successfully.
  5. Install a pack in a fresh configuration without --trust-native-grammars, then run red --check-config; expect CFG401 and an explicit native-grammar approval requirement.

@fcoury-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 049cf212c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fcoury-oai
fcoury-oai merged commit e4ea1c8 into master Aug 5, 2026
16 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/arborium-language-support branch August 5, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant