dioxus
dioxus copied to clipboard
`rsx` assumes `get_line_num` to be in scope
This doesn't compile:
use dioxus::prelude::rsx;
fn main() {
rsx!(div {});
}
Error:
error: cannot find macro `get_line_num` in this scope
--> docs/guide/examples/test.rs:4:5
|
4 | rsx!(div {});
| ^^^^^^^^^^^^
|
= note: consider importing this macro:
dioxus::prelude::get_line_num
= note: this error originates in the macro `rsx` (in Nightly builds, run with -Z macro-backtrace for more info)
Importing the full prelude fixes it. Still, would be nice for the macro to be accessed through the absolute path for rsx to be clean.
- [x] I'm doing something else right now, but maybe I'll fix this later
We could use absolute paths for most of the macro, and with rsx-prelude it should still work in tests. I think @jkelleyrtp had some thoughts on this? dioxus_elements also needs to be in scope, which could be provided by dioxus or by the renderer so it needs to manually imported.
dioxus_elements also needs to be in scope
This makes sense, since it is essentially used in user code (every time you type div you mean dioxus_elements::div or something). get_line_num is only in the generated code, and I agree that using the absolute path would be better because:
get_line_nummight not be in scopeget_line_nummight refer to something else in the scope, leading to weird issues
I believe this is fixed? If it hasn't, it will be in #387