Skip to content
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

Modern up the dx section 2.1 (RA supports #[server]?) #177

Open
fsktom opened this issue Mar 10, 2025 · 2 comments
Open

Modern up the dx section 2.1 (RA supports #[server]?) #177

fsktom opened this issue Mar 10, 2025 · 2 comments

Comments

@fsktom
Copy link

fsktom commented Mar 10, 2025

Hi, I had been reading the book while learning leptos (using the 0.8 alpha branch if that matters). Overall, great experience, thanks! I noticed a few inconsistencies - things working differently nowadays, some broken links etc.

https://github.com/leptos-rs/book/blob/5b2c1abc65452e71539f612428d34d72cfa358b5/src/getting_started/leptos_dx.md#2-editor-autocompletion-inside-component-and-server

I don't know what, when (or even if?) something changed, but I removed server from the proc macro ignore list and the editor auto-complete works fine for me? (Visual Studio Code 1.98, rust-analyzer 0.3.2337, leptos-related crates @ leptos-rs/leptos@d0bf843)

Seems like the macro is expanded properly and gives great IDE support for ServerActions created with it

Image

Maybe we should add another note saying that #[server] macros should work with rust-analyzer and make the proc macro ignore list completely optional in the book?

@gbj
Copy link
Contributor

gbj commented Mar 10, 2025

PR welcome to add such a note, and/or to fix any of the inconsistencies or broken links you noticed. We've tried to make support for completion within the macros better over time, so I'm not surprised if it's gotten better.

@fsktom
Copy link
Author

fsktom commented Mar 12, 2025

Ah sorry, I've just noticed that rust-analyzer can't figure out the original function if #[server] is expanded. While (obviously) it can't figure out the generated ServerAction struct if macro expansion is disabled. So I guess the point from the book still stands, I just forgot to look back at the function :/

I'll take a look at the other stuff and see if I can produce a good PR though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants