tree-sitter-svelte-next Svelte Themes

Tree Sitter Svelte Next

A modern Svelte grammar for tree-sitter, compatible with tree-sitter 0.25 and later versions.

tree-sitter-svelte-next

A modern Svelte grammar for tree-sitter, compatible with tree-sitter 0.25 and later versions.

Overview

This project provides a tree-sitter parser for the Svelte framework, enabling syntax highlighting, code navigation, and other advanced editor features for Svelte files. It includes support for Svelte's unique syntax including components, reactive declarations, template syntax, and embedded JavaScript/TypeScript and CSS.

Features

  • Full Svelte syntax support
  • Compatible with tree-sitter 0.25+
  • Comprehensive query files for:
    • Syntax highlighting (highlights.scm)
    • Language injections for <script> and <style> blocks (injections.scm)
    • Local variable tracking (locals.scm)
  • Rust bindings with C-based parser implementation
  • Extensive test coverage

Installation

Add this to your Cargo.toml:

[dependencies]
tree-sitter-svelte-next = "0.1.0"

Contributing

Contributions are welcome. Please ensure that:

  1. All tests pass (cargo test)
  2. Code follows Rust formatting standards (cargo fmt)
  3. New features include appropriate tests

Acknowledgments

This grammar builds upon the tree-sitter ecosystem and the Svelte community's work in defining the language's syntax and semantics.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Top categories

Loading Svelte Themes