Skip to content
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

Reimplement mox with syn_rsx #228

Merged
merged 24 commits into from
Jan 10, 2021
Merged

Conversation

zetanumbers
Copy link
Contributor

@zetanumbers zetanumbers commented Dec 30, 2020

Current implementation of the mox macro uses snax with proc_macro_hack crate. This causes rust-analyzer lining errors. For the reason of snax not being regularly supported i recommend to switch to the syn_rsx crate, which solves these problems and adds linting for the tags and attributes.

  • Update docs for the mox crate

@anp

This comment has been minimized.

Copy link
Owner

@anp anp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One nit and CI needs to be happy but otherwise I'm happy to merge this.

EDIT: outdated

.vscode/settings.json Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 31, 2020

Codecov Report

Merging #228 (619236f) into main (4d14a31) will decrease coverage by 0.04%.
The diff coverage is 31.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #228      +/-   ##
==========================================
- Coverage   27.78%   27.74%   -0.05%     
==========================================
  Files          50       49       -1     
  Lines       11886    11967      +81     
  Branches     6634     6685      +51     
==========================================
+ Hits         3303     3320      +17     
- Misses       6391     6417      +26     
- Partials     2192     2230      +38     
Impacted Files Coverage Δ
dom/examples/ssr/src/main.rs 36.66% <0.00%> (-0.63%) ⬇️
dom/examples/todo/src/filter.rs 0.00% <ø> (ø)
dom/src/lib.rs 0.00% <ø> (ø)
dom/tests/custom_component.rs 0.00% <0.00%> (ø)
dom/examples/todo/src/item.rs 22.24% <25.00%> (ø)
mox/impl/src/lib.rs 36.84% <31.12%> (-10.45%) ⬇️
dom/examples/todo/src/input.rs 24.85% <33.33%> (ø)
dom/src/interfaces/node.rs 55.55% <33.33%> (-24.45%) ⬇️
mox/tests/derive_builder.rs 55.17% <100.00%> (+7.17%) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d14a31...619236f. Read the comment docs.

@zetanumbers zetanumbers changed the title Support rust-analyzer Reimplement mox with syn_rsx Jan 1, 2021
Copy link
Owner

@anp anp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really cool! A bunch of feedback and questions but I like this direction a lot.

dom/examples/todo/src/footer.rs Outdated Show resolved Hide resolved
dom/examples/todo/src/input.rs Show resolved Hide resolved
dom/examples/todo/src/item.rs Outdated Show resolved Hide resolved
mox/src/lib.rs Outdated Show resolved Hide resolved
dom/src/interfaces/node.rs Outdated Show resolved Hide resolved
mox/impl/src/lib.rs Outdated Show resolved Hide resolved
mox/impl/src/lib.rs Outdated Show resolved Hide resolved
mox/impl/src/lib.rs Outdated Show resolved Hide resolved
mox/impl/src/lib.rs Outdated Show resolved Hide resolved
mox/impl/src/lib.rs Show resolved Hide resolved
@anp

This comment has been minimized.

@zetanumbers zetanumbers requested a review from anp January 7, 2021 16:40
mox/impl/src/lib.rs Outdated Show resolved Hide resolved
mox/impl/Cargo.toml Show resolved Hide resolved
Copy link
Owner

@anp anp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great! Can you apply this patch to update the changelog?

diff --git a/mox/CHANGELOG.md b/mox/CHANGELOG.md
index 99fc8a0..a380754 100644
--- a/mox/CHANGELOG.md
+++ b/mox/CHANGELOG.md
@@ -7,7 +7,26 @@
 
 <!-- categories: Added, Removed, Changed, Deprecated, Fixed, Security -->
 
-## [0.10.0] - unreleased
+## [0.11.0] - 2021-01-10
+
+### Added
+
+- "Attribute init shorthand" allows pulling an attribute from an identically-named binding in the
+  local scope:
+  ```rust
+  let onclick = |_| { ... };
+  mox!(<button onclick>"click me?"</button>)
+  ```
+- Module-nested tag names: `mox!(<krate::module::tag>"foo"</krate::module::tag>)`.
+- Attributes support single-expression values without braces: `<button disabled=true/>`.
+- XML comments: `mox!(<div> <!-- COMMENT HERE --> </div>)`.
+
+### Changed
+
+- `mox!` invocations are now lexed by the [syn-rsx](https://docs.rs/syn-rsx) crate.
+- Non-tag children have `.into_child()` appended to them.
+
+## [0.10.0] - 2020-07-06
 
 ### Removed
 

mox/CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Adam Perry <lol@anp.lol>
Copy link
Owner

@anp anp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! CI should be happy still, will land once its green.

@anp anp merged commit 0362f28 into anp:main Jan 10, 2021
@zetanumbers zetanumbers deleted the rust-analyzer-compatibility branch January 10, 2021 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants