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

Compile-time checked element names #327

Closed
lukechu10 opened this issue Dec 31, 2021 · 1 comment · Fixed by #354
Closed

Compile-time checked element names #327

lukechu10 opened this issue Dec 31, 2021 · 1 comment · Fixed by #354
Labels
A-macro Area: macros BREAKING CHANGE Breaking changes introduced in this PR C-enhancement Category: new feature or improvement to existing feature D-hard Difficulty: hard
Milestone

Comments

@lukechu10
Copy link
Member

lukechu10 commented Dec 31, 2021

Element names should be checked at compile-time for the view! macro. This will be implemented by declaring structs for all possible html tags, e.g.

struct a;
struct button;
struct div;
// etc...

This will also allow the opportunity to have nice ide hover support and hopefully completions for html tags.

For custom elements, the syntax will be slightly changed to force the name to be in quotes, e.g.

view! {
    "my-custom-element" {
        // ...
    }
}
@lukechu10 lukechu10 added C-enhancement Category: new feature or improvement to existing feature A-macro Area: macros BREAKING CHANGE Breaking changes introduced in this PR D-hard Difficulty: hard labels Dec 31, 2021
@arctic-hen7
Copy link
Contributor

Do you think it's worth dynamically generating these for the HTML backend with a build script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro Area: macros BREAKING CHANGE Breaking changes introduced in this PR C-enhancement Category: new feature or improvement to existing feature D-hard Difficulty: hard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants