Skip to content

feat: add Astro syntax highlighting support - #190

Merged
unhappychoice merged 1 commit into
mainfrom
feat/astro-syntax-highlighting
Apr 20, 2026
Merged

unhappychoice merged 1 commit into
mainfrom
feat/astro-syntax-highlighting

Conversation

@unhappychoice

@unhappychoice unhappychoice commented Apr 20, 2026 •

Copy link
Copy Markdown
Owner

close: #172

Summary

  • Add tree-sitter-astro-next dependency for Astro language parsing
  • Create astro.rs language module with language function and highlight query
  • Register .astro extension in the language mapper

Test plan

  • cargo check passes
  • cargo test passes
  • cargo clippy --all-targets -- -D warnings passes
  • cargo fmt passes
  • Highlighter produces spans for a sample .astro file

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added syntax highlighting support for Astro files with .astro extension.
  • Documentation

    • Updated supported languages list to include Astro.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 20, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Added Astro syntax highlighting support by integrating the tree-sitter-astro-next dependency. Created a new language module exposing the Astro language and highlight query, registered the "astro" file extension mapping in the language dispatcher, and updated documentation.

Changes

Cohort / File(s) Summary
Dependency & Documentation
Cargo.toml, README.md
Added tree-sitter-astro-next dependency to enable Astro grammar compilation; updated supported languages list in README.
Astro Language Support
src/syntax/languages/astro.rs, src/syntax/languages/mod.rs
Created new Astro language module with language() function and HIGHLIGHT_QUERY constant; exported module and registered "astro" extension routing in language dispatcher.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • PR #66: Adds new Tree-sitter language support following the identical pattern—dependency addition, language module creation with public language() and HIGHLIGHT_QUERY, and extension registration in mod.rs.
  • PR #110: Implements Tree-sitter language integration using the same established approach: crate dependency, src/syntax/languages/<lang>.rs module with required exports, and dispatcher wiring.

Poem

🐰 A new constellation joins our sky,
Astro shines with syntax's gleaming eye,
Tree-sitter weaves the highlight thread,
More languages parsed, the rabbits said! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: add Astro syntax highlighting support' clearly and accurately summarizes the main change: adding Astro language syntax highlighting support.
Linked Issues check ✅ Passed The pull request successfully implements the requirement from issue #172 by integrating tree-sitter-astro-next dependency, creating an astro.rs module, and registering .astro file extension support.
Out of Scope Changes check ✅ Passed All changes are directly scoped to adding Astro syntax highlighting support: dependency addition, module creation, language registration, and documentation update.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/astro-syntax-highlighting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README.md (1)

67-183: ⚠️ Potential issue | 🟡 Minor

Update the supported language count.

Adding Astro brings the list to 30 languages, but Line 67 still says 29.

📝 Proposed fix
-🎨 **Tree-sitter Syntax Highlighting** — 29 languages supported
+🎨 **Tree-sitter Syntax Highlighting** — 30 languages supported
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 67 - 183, Update the language count in the README:
change the header line "🎨 **Tree-sitter Syntax Highlighting** — 29 languages
supported" to "🎨 **Tree-sitter Syntax Highlighting** — 30 languages supported"
so the documented count matches the supported languages list (Astro added).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@README.md`:
- Around line 67-183: Update the language count in the README: change the header
line "🎨 **Tree-sitter Syntax Highlighting** — 29 languages supported" to "🎨
**Tree-sitter Syntax Highlighting** — 30 languages supported" so the documented
count matches the supported languages list (Astro added).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e9071137-19d3-456b-9adc-745be5f0d6bb

📥 Commits

Reviewing files that changed from the base of the PR and between 15be1b8 and 15513f3.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • README.md
  • src/syntax/languages/astro.rs
  • src/syntax/languages/mod.rs

@unhappychoice
unhappychoice merged commit f309314 into main Apr 20, 2026
7 checks passed
@unhappychoice
unhappychoice deleted the feat/astro-syntax-highlighting branch April 20, 2026 15:01
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.

feat: Astro syntax highlighting support

1 participant