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

Make a clearer error message for View Macro #307

Open
RampedIndent opened this issue Feb 6, 2023 · 0 comments
Open

Make a clearer error message for View Macro #307

RampedIndent opened this issue Feb 6, 2023 · 0 comments

Comments

@RampedIndent
Copy link

Currently if there is invalid data entered into the view!() macro the below error shows up at #[widget]

65 | #[widget]
   | ^^^^^^^^^
   |
   = help: message: should be an ident: Error("expected identifier")

Ideally this error should highlight the invalid data.
Or the error message could be clarified that the unexpected identifier is in the view macro. Since a large quantity of code can be in the impl block below #[widget]

This invalid data could include like show below if you put an if statement.

#[widget]
impl Widget for Win {
  // misc code here
  // .....
  view!(){
    gtk::Entry {
        editable: self.model.publish_path_generate.eq(&false).to_owned(),
         if &self.model.publish_path_generate{
             text: &self.model.publish_path,
         } else {
             text: &self.publish_path_custom,
         }
        changed(entry) => {
            let text = entry.text().to_string();
            Msg::TextEntered(text, TextInputFields::PublishPath)
        },
    },
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants