Updated tree-sitter grammar to match v0.3.0 LALRPOP parser: Grammar updates: - Schedule: block-based syntax with extends, override, recurrence - Life arc: requires clause for field validation - Template: uses behaviors/schedules syntax - Behavior: correct keywords (choose/then/repeat with optional params) - Type system: concept_comparison with any/is_condition - Removed concept semicolon requirement Query file updates: - highlights.scm: updated node names to *_declaration - outline.scm: updated for new declaration node names - indents.scm: updated node names, removed concept semicolon Corpus test updates: - Created schedules.txt with v0.3.0 syntax tests - Created highlights.txt for highlighting tests - Updated type_system.txt for v0.3.0 type syntax - Updated behaviors.txt for correct expression wrapping - Updated declarations.txt to use correct node names - Updated basic.txt to use character_declaration/character_body - Deleted obsolete v0.2.0 syntax tests Integration tests: - Added tree_sitter_integration.rs test suite - Fixed test_any_type to use correct v0.3.0 syntax - Fixed test_tree_sitter_grammar_builds to use generate command
Storybook Extension for Zed
This extension provides language support for the Storybook narrative DSL in Zed.
Features
- Syntax highlighting for all Storybook constructs
- Markdown support in prose blocks (inline markdown highlighting)
- Document outline showing characters, templates, relationships, etc.
- Bracket matching including special
---prose block markers - Auto-indentation with proper block handling
- LSP integration (when storybook-lsp is installed)
- Real-time diagnostics
- Hover documentation
- Go-to-definition
- Find references
- Autocomplete
- Document formatting
Installation
For Development (from this repository)
-
Build the extension (includes LSP server):
cd zed-storybook ./build-extension.sh -
Install the extension in Zed:
- Open Zed
- Run command:
zed: install dev extension(Cmd+Shift+P) - Select the
zed-storybookdirectory
-
Test:
- Open a
.sbfile in Zed - The LSP should activate automatically
- Try hovering over symbols to see rich information!
- Open a
Note: The build-extension.sh script builds the LSP server and copies the binary into bin/storybook-lsp for local testing. The extension will automatically find it there.
For Users (once published)
- Open Zed
- Open the command palette (Cmd+Shift+P)
- Search for "Extensions: Install Extensions"
- Search for "Storybook"
- Click Install
Usage
Once installed, the extension will automatically activate for .sb files.
Syntax Highlighting
The extension provides rich syntax highlighting:
- Keywords (character, template, relationship, etc.) in purple
- Strings in yellow
- Numbers in light purple
- Comments in gray
- Prose blocks with Markdown syntax highlighting inside
Prose Blocks with Markdown
Prose blocks support full Markdown syntax:
character Alice {
---backstory
Alice was a **curious** girl who loved:
- Reading books
- Asking questions
- *Adventures*
She often wondered about the world.
---
}
The markdown inside prose blocks will be highlighted appropriately.
LSP Features
If you have storybook-lsp installed, you'll get:
- Real-time validation - Errors and warnings as you type
- Hover information - Documentation and type info on hover
- Go to definition - Jump to character/template definitions
- Find references - See where entities are used
- Autocomplete - Suggestions for field names, entity names, etc.
Configuration
The extension uses these default settings:
- Tab size: 4 spaces
- Line comments:
// - Block comments:
/* */ - Auto-close brackets: Yes
You can customize these in Zed's settings.
Language Server
The extension looks for storybook-lsp in your PATH. To install it:
# From the storybook repository
cargo install --path storybook --bin storybook-lsp
File Association
The extension automatically activates for files with the .sb extension.
Troubleshooting
Extension not loading
- Check that the extension is in
~/.local/share/zed/extensions/installed/storybook - Restart Zed
- Check the Zed log for errors (Zed > View > Toggle Terminal > "Extensions" tab)
LSP not working
- Verify
storybook-lspis in your PATH:which storybook-lsp - Check Zed's LSP log for errors
- Ensure you have the latest version installed
Syntax highlighting issues
- Ensure the file has the
.sbextension - Try reloading the window (Cmd+Shift+P > "Reload Window")
- Check that the grammar is correctly installed
Development
To modify or contribute to this extension:
- Clone the repository
- Make your changes
- Test with
cargo build - Submit a pull request
License
MIT