dejmedus / tailwind-sorter

Sorts tailwind classes in a predictable way
https://marketplace.visualstudio.com/items?itemName=dejmedus.tailwind-sorter
7 stars 2 forks source link

Adding Rust (.rs) file to support Leptos. #13

Closed kuskhan closed 3 weeks ago

kuskhan commented 1 month ago

First of all, thank you for creating this wonderful extension. I would like to suggest adding Rust file extension support to enable compatibility with Leptos. I've tested this by adding the following line, and can confirm it works well with .rs files in the Leptos framework:

// tailwind-sorter/src/extension.ts

...
    const languages = [
      "html",
      "vue",
      "javascriptreact",
      "typescriptreact",
      "elixir",
      "phoenix-heex",
      "astro",
      "rust",  // here added
    ];
...

an example sorted by the extension:

// my-project/src/app.rs

/// Renders the home page of your application.
#[component]
fn HomePage() -> impl IntoView {
    // Creates a reactive value to update the button
    let count = RwSignal::new(0);
    let on_click = move |_| *count.write() += 1;

    view! {
        <h1 class="flex flex-row">"Welcome to Leptos!"</h1>
        <button on:click=on_click>"Click Me: " {count}</button>
    }
}
dejmedus commented 4 weeks ago

Thank you for the link/examples and testing this out! Leptos looks cool

Should now work on .rs files in v0.0.83 [#14]

kuskhan commented 4 weeks ago

Thank you so much for the quick implementation of Leptos (Rust) support. When I opened VS Code this morning, the extension was updated and it's working perfectly.