Comments (8)
I can reproduce it now. The formatter doesn't like inline comments and removes them completely:
rsx! {
div { // this comment will be removed
"hi",
}
}
from dioxus.
I am unable to reproduce this using the git version of the CLI. Can you test the git version of the CLI on your end?
You can install the git version with:
cargo install --git https://github.com/DioxusLabs/dioxus dioxus-cli
from dioxus.
I did run the command to install git version and checked again:
- // TODO: Implement event handling here -> listen to eve
nts in child
let accept_keys = [Key::Enter, Key::Character(" ".to_string())];
- if accept_keys.contains(&evt.key()){
+ if accept_keys.contains(&evt.key()) {
log::info!("{} pressed in {}", evt.key(), "{props.labelText}");
log::info!("{} pressed in {}", evt.key(), "{props.labelText}");
}
},
class: "flex flex-1 h-full w-3/4 items-center justify-center btn btn-outline my-1 py-1",
- div { class: "flex-none py-1", // TODO: Refactor into separate component
+ div { class: "flex-none py-1",
Icon { width: 24, height: 24, icon: props.icon, title: "{props.iconTitle}" }
- },
+ }
"{props.labelText}"
- input { // TODO: Refactor into separate component
+ input {
dx -V says:
dioxus 0.5.2
from dioxus.
this also seems to affect the VSCode Dioxus extension. Block-level comments (/* .. */
) are also affected; doc comments (///
) however are not.
from dioxus.
Adding to the list.
All comments are removed in event handlers (except doc comments):
rsx! {
div {
// also occurs in move || async move
onclick: move |_| {
// is removed
/* is removed */
}
}
}
from dioxus.
I think it comes from here:
dioxus/packages/cli/src/cli/autoformat.rs
Lines 249 to 253 in 472031d
syn does not keep comments.
https://crates.io/crates/rustfmt-wrapper (or spawning rustfmt
directly) could be used instead.
This won't help in non-rust code, but I think it's a start.
I don't know if Dioxus developers would agree with this solution, but if they do, I would be happy to do it.
from dioxus.
We try our best to preserve comments by writing out whitepace on rsx indents, but there's no way to preserve whitespace with prettyplease. I'd be interested in supporting the rustfmt wrapper approach, but it is convenient for autoformatting to not rely on rustfmt so we can use it in things like wasm.
from dioxus.
What if it was behind a target cfg? Wasi support spawning new tasks, so rustfmt would work.
But it's true it's not an ideal solution.
from dioxus.
Related Issues (20)
- Assigning a port number when using `dx serve --port [number]` on fullstack is not respected. HOT 2
- Ctrl/cmd click does not open in a new tab/window
- Dioxus-cli ignores env variables in `.cargo/config.toml` HOT 2
- pointermove events on Windows crash with InvalidType HOT 4
- [Desktop] Hot reloading does not work in the "tailwind" sample
- question: custom rendering to arbitrary wayland surface HOT 4
- Hydration error when using use_server_future in certain contexts in Fullstack
- Docs have a couple outdated examples
- how to spawn a thread in main or other place only once HOT 2
- Add `-p package` option to Dioxus CLI HOT 1
- Rerender fails when rendering an iterable with `None` elements inside HOT 1
- how to send channel to child component HOT 8
- `use_reactive` inside `use_memo` causes infinite re-renders HOT 2
- `rsx` macro should prevent any children in self-closing elements
- Provide type checking support for HTML attribute values in `rsx` macro HOT 2
- HTML String into rsx! HOT 3
- Update TailwindCSS Example Project HOT 2
- Add support for attaching event listeners to the global window HOT 2
- Hot reload doesn't turn off when using `--hot-reload=false`
- Assets in Dioxus build are "unpacked" from the original directory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dioxus.