DioxusLabs / dioxus

Fullstack GUI library for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
19.33k stars 736 forks source link

Dioxus LSP to auto suggest available properties of rsx #2187

Closed gusinacio closed 3 weeks ago

gusinacio commented 3 months ago

Feature Request

Create an LSP implementation of rsx to auto-suggest all the properties available for rsx. Right now, rust-analyzer doesn't suggest any properties of rsx components. It's good to work with because the compiler gives good hints, but an LSP would be an awesome developer experience.

Implement Suggestion

Not really a suggestion, but maybe rust-analyzer exposes APIs that helps to get the correct suggestions for auto complete lsp.

jkelleyrtp commented 3 months ago

Gonna try taking a stab at this in the next devtools-focused release!

SkiFire13 commented 1 month ago

FYI this discussion might be helpful https://github.com/rust-lang/rust-analyzer/discussions/15452

In particular this part:

That is, if your macro only gets partial input (let's say, a certain identifier is missing that you expect), then your macro should generate output that mostly resembles what it should be if the input was complete (instead of turning the entire output into a single compile_error!(...) invocation, as that will erase basically all the information the IDE could make use of.

The rsx macro seems to return just a compile_error!(...) when the parsing fails, which doesn't give IDEs enough informations for completition hints.

ealmloff commented 3 weeks ago

https://github.com/DioxusLabs/dioxus/pull/2421 Fixes autocomplete in rsx. We now autocomplete attributes, elements, and braces in rsx