upvote
> you can accomplish this

That's not HTML though, you have to learn a whole new dsl that must conform to rust parser rules. So, not the same thing at all.

reply
You can do actual html. This is Leptos, a Solidjs like rust library:

    #[component]
    fn App() -> impl IntoView {
        let (count, set_count) = signal(0);
        view! {
            <button
                on:click=move |_| set_count.set(3) >
                "Click me”</button>
            <p>{move || count.get() * 2}</p>
        }
    }
reply
does it still work if you remove that space before the tag's closing character in this line?

    on:click=move |_| set_count.set(3) >
reply
i prefer it, but you can also get html if you want

eg

   html! {
       <div onclick=|_ev: web_sys::MouseEvent| {}>
          You can type text right into the elements
          { component }
          { text_var }
       </div>
    };
reply
but you have invented syntax
reply
This is just Twig templates, crazy. It's cool that Rust can do this out of a box
reply
yep and you get rust's lsp support too, autoformatting, etc.

this is rsx, but there are other macros that look just like html. i prefer this though, it's much more compact and readable imo

reply
I'm not a fan of Rust, the overly flexible macros are actually one reason for it, but if you can indeed get LSP support in a custom syntax like this, that's really awesome. Thank you for the example.
reply
do you think that when compiler internals 'settle down' it will (gradually) be exposed through some interfaces (like compiler plugins in jai) so that we can more easily develop LSP for quasi-zig formats like this ?

That would be great, I really like openness and ~plugin interfaces of jai compiler internals ...

reply
[dead]
reply
That is super cool actually
reply