Fix non-brace delimeters in nested macro formatting (#2831)
This commit is contained in:
1 parent
d649b0c54d
commit
851abe82d5
6 files changed
+255
-6
No files matched your search
@@ -1,5 +1,5 @@
|
||||
use dioxus_rsx::CallBody;
|
||||
use syn::{parse::Parser, visit_mut::VisitMut, Expr, File, Item};
|
||||
use syn::{parse::Parser, visit_mut::VisitMut, Expr, File, Item, MacroDelimiter};
|
||||
|
||||
use crate::{IndentOptions, Writer};
|
||||
|
||||
@@ -46,6 +46,11 @@ pub fn unparse_expr(expr: &Expr, src: &str, cfg: &IndentOptions) -> String {
|
||||
i.path = syn::parse_str(MARKER).unwrap();
|
||||
i.tokens = Default::default();
|
||||
|
||||
// make sure to transform the delimiter to a brace so the marker can be found
|
||||
// an alternative approach would be to use multiple different markers that are not
|
||||
// sensitive to the delimiter.
|
||||
i.delimiter = MacroDelimiter::Brace(Default::default());
|
||||
|
||||
// Push out the indent level of the formatted block if it's multiline
|
||||
if multiline || formatted.contains('\n') {
|
||||
formatted = formatted
|
||||
|
||||
Reference in new issue
Block a user