Updated extension.toml: - Version bumped to 0.3.0 - Grammar rev updated to v0.3 tree-sitter commit Updated Zed highlights.scm with type system support: - concept, sub_concept, concept_comparison keywords - any keyword highlighting - Named field highlights for type system declarations - Template species reference highlighting - sub_concept_field property highlighting
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