### Run documentation site locally Source: https://github.com/wsafight/gpui-rsx/blob/main/README.md Commands to install dependencies and start the local development server for the documentation. ```bash cd docs bun install bun run dev ``` -------------------------------- ### Build documentation site Source: https://github.com/wsafight/gpui-rsx/blob/main/docs/src/content/docs/guides/performance.md Build the documentation site for navigation and example verification. ```bash cd docs bun run build ``` -------------------------------- ### Clone and Setup Repository Source: https://github.com/wsafight/gpui-rsx/blob/main/CONTRIBUTING.md Commands to clone the repository and add the upstream remote. ```bash git clone https://github.com/YOUR_USERNAME/gpui-rsx.git cd gpui-rsx ``` ```bash git remote add upstream https://github.com/wsafight/gpui-rsx.git ``` -------------------------------- ### Implement a CounterView with GPUI-RSX Source: https://github.com/wsafight/gpui-rsx/blob/main/README.md A complete example demonstrating how to define a view and render it using the rsx! macro. ```rust use gpui::*; use gpui::prelude::*; use gpui_platform::application; use gpui_rsx::rsx; struct CounterView { count: i32, } impl Render for CounterView { fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { rsx! {

{format!("Count: {}", self.count)}

} } } fn main() { application().run(|cx: &mut App| { cx.open_window(WindowOptions::default(), |_, cx| { cx.new(|_cx| CounterView { count: 0 }) }).unwrap(); cx.activate(true); }); } ``` -------------------------------- ### Define a Complete GPUI View Source: https://github.com/wsafight/gpui-rsx/blob/main/docs/src/content/docs/getting-started.md A full example implementing the Render trait and running the application. ```rust use gpui::*; use gpui::prelude::*; use gpui_platform::application; use gpui_rsx::rsx; struct HelloView; impl Render for HelloView { fn render(&mut self, _window: &mut Window, _cx: &mut Context) -> impl IntoElement { rsx! {

{"Hello GPUI-RSX"}

{"This markup expands to GPUI builder calls."}

} } } fn main() { application().run(|cx: &mut App| { cx.open_window(WindowOptions::default(), |_, cx| { cx.new(|_cx| HelloView) }).unwrap(); cx.activate(true); }); } ``` -------------------------------- ### Rust function documentation and implementation Source: https://github.com/wsafight/gpui-rsx/blob/main/CONTRIBUTING.md Example of documenting a public API and defining a function in Rust. ```rust /// Parses an RSX element from the token stream. /// /// # Arguments /// /// * `input` - The token stream to parse /// /// # Returns /// /// Returns a `Result` containing the parsed element or an error. /// /// # Examples /// /// ```rust /// let element = parse_element(tokens)?; /// ``` fn parse_element(input: ParseStream) -> Result { // Implementation details... } ``` -------------------------------- ### Common Styling Patterns Source: https://github.com/wsafight/gpui-rsx/blob/main/README.md Examples of conditional literals, the 'when' attribute for flexible styling, and dynamic string formatting. ```rust // ✅ Conditional literal (compile-time, documented subset) let button_class = if primary { "bg-blue-500 text-white" } else { "bg-gray-200 text-black" }; // ✅ when attribute (compile-time, fully flexible) rsx! {
} // ✅ Dynamic string with numeric prefix and arbitrary hex colors let classes = format!("flex gap-{} bg-[#ff0000]", spacing); // gap-7, gap-32, etc. all work ``` -------------------------------- ### Expand Macros for Debugging Source: https://github.com/wsafight/gpui-rsx/blob/main/README.md Commands to install and use cargo-expand to inspect generated code. ```bash # Install cargo-expand cargo install cargo-expand # View expanded code cargo expand --lib ``` -------------------------------- ### Static RSX Expansion Source: https://github.com/wsafight/gpui-rsx/blob/main/docs/src/content/docs/guides/performance.md Example of static RSX markup that is resolved during macro execution. ```rust rsx! {
{"Hello"}
} ``` -------------------------------- ### Macro Invocation Example Source: https://github.com/wsafight/gpui-rsx/blob/main/ARCHITECTURE.md The initial rsx! macro call defining a div element with attributes and children. ```rust rsx! {
{"Hello"}
} ``` -------------------------------- ### Identify Method Name Errors Source: https://github.com/wsafight/gpui-rsx/blob/main/ARCHITECTURE.md Example of a common compilation error indicating an invalid method name used in the DSL. ```text error[E0599]: no method named `flex_col` found for struct `Div` ``` -------------------------------- ### Build and Test Project Source: https://github.com/wsafight/gpui-rsx/blob/main/CONTRIBUTING.md Standard commands to build the project and verify functionality. ```bash cargo build ``` ```bash cargo test ``` -------------------------------- ### Run demo applications Source: https://github.com/wsafight/gpui-rsx/blob/main/demo/README.md Execute specific binary targets within the demo directory. ```bash cd demo cargo run --bin hello cargo run --bin counter cargo run --bin palette cargo run --bin task_list cargo run --bin project_dashboard cargo run --bin incident_console cargo run --bin api_surface cargo run --bin component ``` -------------------------------- ### Update application startup logic Source: https://github.com/wsafight/gpui-rsx/blob/main/docs/src/content/docs/guides/migration.md Migrate from the legacy Application::new() pattern to the updated application() platform-based startup. ```rust Application::new().run(|cx: &mut App| { cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| MyView)); }); ``` ```rust use gpui_platform::application; application().run(|cx: &mut App| { cx.open_window(WindowOptions::default(), |_, cx| { cx.new(|_| MyView) }).unwrap(); cx.activate(true); }); ``` -------------------------------- ### Run the Incident Console demo Source: https://github.com/wsafight/gpui-rsx/blob/main/docs/src/content/docs/examples/incident-console.md Execute the application using the project's specific manifest and binary configuration. ```bash cargo run --manifest-path demo/Cargo.toml --bin incident_console --locked ``` -------------------------------- ### Run Demo Commands Source: https://github.com/wsafight/gpui-rsx/blob/main/docs/src/content/docs/getting-started.md Commands to verify and run the demo application included in the repository. ```bash cargo check --manifest-path demo/Cargo.toml --bins --locked ``` ```bash cargo run --manifest-path demo/Cargo.toml --bin incident_console --locked ``` -------------------------------- ### Build and Test Commands Source: https://github.com/wsafight/gpui-rsx/blob/main/README.md Standard commands for building the project and running macro-specific tests. ```bash cd gpui-rsx cargo build ``` ```bash cargo test --test macro_tests ``` -------------------------------- ### Verify all demo binaries Source: https://github.com/wsafight/gpui-rsx/blob/main/demo/README.md Run a check on all binaries to ensure build reproducibility after dependency updates. ```bash cd demo cargo check --bins ``` -------------------------------- ### Use percentages and fractions for sizing Source: https://github.com/wsafight/gpui-rsx/blob/main/docs/src/content/docs/usage/class.md Sizing utilities support fractional and percentage-based values. ```rust rsx! {