-
-
Notifications
You must be signed in to change notification settings - Fork 696
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
rstml 0.12 and braces in attribute values #2769
Conversation
The failing check seems to be on something unrelated. Sorry about the bunch of commits, cargo fmt didn't want to format properly for some reason. I can squash some of the commits together if you'd like |
I'll have to wait for blorbb to answer your question, but I believe the desire was to reduce ambiguity by requiring expressions to have braces. Personally I like the idea of the clear separation of rust code and what is basically html |
Hm that's odd, I can't seem to recreate your first screenshot when I remove the errors. The second screenshot does work because The point by @benwis is also true, it would be good to keep clear separation between HTML and rust. p.s. is there some way to remove all the methods suggested by |
@gbj is it possible to put it together for a poll? These changes are really awkward in terms of readability. There are too much of unnecessary braces! If they are mandated, it will reduce readability for sure! |
I want to make sure there is a clear benefit here before making it a required breaking change. I tried to run an experiment this morning to test it. The test: What autocompletion do we get, with and without erroring? PR as is, with error if no braces PR removing the no-braces error, then restarting rust-analyzer It is entirely possible I'm doing something wrong or this is not the intended scenario, but I am not seeing any improvement if it errors when braces are not used. Are you seeing different behavior? It is possible my environment is messed up somehow, I change between so many different branches so frequently that I wouldn't be surprised. |
If we actually can't find any improvement, perhaps we leave it as a leptosfmt option. However, no other thing in html has multi-word undelineated arguments, so I'm fairly heavy in favor. As mentioned in the PR, this is how Svelte and a couple of others have gone |
Sorry for the late response, haven't had much time recently. I have no clue why Requiring braces is not necessary for this to work, it's just if you want to enforce a style. Adding braces will just improve r-a support in some cases, but this will work even if braces are not required. If you would prefer to not have the breaking change, feel free to remove the lines around the |
This is great to know, and this makes sense to me. I think I will plan to
(It may take me a few days to make these changes and merge the PR; if you'd like to do them instead, that's also very welcome! I will likely get to it this Friday.) I think opinions on style differ enough (as can be seen even in this thread!) that mandating style changes has the potential to be dangerous to the community/hard for adoption. I am really glad that there is a middle ground. And thanks again for all your work. |
Done separately in #2884 for my sanity, thanks again for your work! |
follow up to #2753