Files
storybook/tree-sitter-storybook/queries/indents.scm
Sienna Meridian Satterwhite c49b00a2dc feat(grammar): add type system nodes to tree-sitter
Added grammar rules for v0.3 type system declarations:
- concept_declaration: semicolon-terminated base type
- sub_concept: enum and record forms with dot notation
- concept_comparison: nested pattern matching with variant_pattern
- any_type: named node for the 'any' keyword
- template species extension: optional ': Species' syntax

Updated query files:
- highlights.scm: new keywords and named field highlights
- outline.scm: concept/sub_concept/concept_comparison in outline
- indents.scm: indentation for new brace-delimited nodes

Fixed pre-existing query issues:
- Replaced invalid repeat_node reference with decorator_node
- Removed invalid '?' punctuation reference

Added comprehensive test corpus (type_system.txt) covering:
- concept declaration (simple and multiple)
- sub_concept enum and record forms
- concept_comparison with any/is conditions
- template with species extension
- full combined example
2026-02-14 14:29:29 +00:00

50 lines
803 B
Scheme

; Indentation query for Storybook DSL
; Increase indent after opening braces
[
"{"
"("
"["
] @indent.begin
; Decrease indent before closing braces
[
"}"
")"
"]"
] @indent.end
; Special handling for prose blocks
(prose_block
marker: (prose_marker) @indent.begin
content: (_)
end: (_) @indent.end
)
; Block structures that should indent their contents
[
(block)
(character)
(template)
(life_arc)
(arc_state)
(schedule)
(schedule_block)
(behavior)
(institution)
(relationship)
(location)
(species)
(enum_declaration)
(selector_node)
(sequence_node)
(decorator_node)
(sub_concept)
(concept_comparison)
(variant_pattern)
] @indent.begin
; Dedent after semicolon at top level
(use_declaration ";" @indent.end)
(concept_declaration ";" @indent.end)