-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leptos / Rust support #25
Comments
I don't think we can support that one through treesitter, because expressions inside macro are parsed as normal rust expressions and don't provide useful information. Example codeuse leptos::*;
use leptos_meta::*;
#[component]
fn App(cx: Scope) -> impl IntoView {
let (count, set_count) = create_signal(cx, 0);
provide_meta_context(cx);
view! { cx,
<Stylesheet id="leptos" href="/pkg/tailwind.css"/>
<button
class="p-1 px-2.5 bg-sky-500 hover:bg-sky-700 focus:outline-none focus:ring focus:ring-sky-300 hover:text-white"
class:rounded-lg=move || count() % 2 == 1
on:click=move |_| {
set_count.update(|n| *n += 1);
}
>
"Click me: " {move || count()}
</button>
}
}
fn main() {
leptos::mount_to_body(|cx| view!{ cx, <App/> })
} Parse tree
To solve this maybe we could add a regex solution as a fallback. |
Leeptos support has been added in #31. |
@luckasRanarison How do I add the server completions for rust files for lepton? I am currently working on a leptos project and below is my config for your plugin: return {
"luckasRanarison/tailwind-tools.nvim",
name = "tailwind-tools",
build = ":UpdateRemotePlugins",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"neovim/nvim-lspconfig",
},
opts = {
server = {
settings = {
includeLanguages = {
rust = "html"
}
}
},
extension = {
patterns = {
rust = { "class=[\"']([^\"']+)[\"']" },
}
}
} -- your configuration
} Running Thanks for any/all help! |
Added rust and heex. #25 (comment)
@highjeans Rust is now supported by default from the server and the plugin so you don't need to add additional server setting or luapattern extension, it should work out of the box. |
@luckasRanarison Thank you so much! |
For some reason I'm having a hard time getting this to work with Leptos which is Rust front end framework. I'm not sure if this is expected or if I'm just doing the setup wrong but wanted to raise that it'd be very cool if this supported leptos.
view!{}
macros might be what make this difficult to achieve so no worries if it's too much effort.Thanks for sharing this btw, really neat plugin 😄
The text was updated successfully, but these errors were encountered: