History

chore: add theme types docs (#2737)

Release Notes: - Added documentation about theme types generation

Nate Butler committed 3 years ago

Commit 27931662 parents 45c6358 cb8762d1 file · +29 −0Browse files

Unified · Split

docs/theme/generating-theme-types.md+29−0
@@ -0,0 +1,29 @@
1[⬅ Back to Index](../index.md)
2
3# Generating Theme Types
4
5
6## How to generate theme types:
7
8Run a script
9
10```bash
11./script/build-theme-types
12```
13
14Types are generated in `styles/src/types/zed.ts`
15
16
17## How it works:
18
191. Rust types
20
21 The `crates/theme` contains theme types.
22 Crate `schemars` used to generate a JSON schema from the theme structs.
23 Every struct that represent theme type has a `#[derive(JsonSchema)]` attribute.
24
25 Task lotaked at `crates/xtask/src/main.rs` generates a JSON schema from the theme structs.
26
272. TypeScript types
28
29 Script `npm run build-types` from `styles` package generates TypeScript types from the JSON schema and saves them to `styles/src/types/zed.ts`.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t