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

Generate reflection for archetypes #6623

Merged
merged 4 commits into from
Jun 25, 2024
Merged

Generate reflection for archetypes #6623

merged 4 commits into from
Jun 25, 2024

Conversation

emilk
Copy link
Member

@emilk emilk commented Jun 24, 2024

What

Replaces the previous code with the new reflection code.

For now I decided that the archetype reflection is still opt-in (with attr.rust.generate_field_info) just to reduce the amount of strings bloating our .wasm binary. We can easily change this in the future if we want to.

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!

To run all checks from main, comment on the PR with @rerun-bot full-check.

@emilk emilk added ui concerns graphical user interface 🚜 refactor Change the code, not the functionality codegen/idl labels Jun 24, 2024
@emilk emilk requested a review from Wumpf June 24, 2024 16:19
@emilk emilk added the exclude from changelog PRs with this won't show up in CHANGELOG.md label Jun 24, 2024
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

good to have this in the same place!


let mut code = format!("// {}\n\n", autogen_warning!());
code.push_str("#![allow(unused_imports)]\n");
code.push_str("#![allow(clippy::too_many_lines)]\n");
Copy link
Member

Choose a reason for hiding this comment

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

huh, news to me that we have this lint active anywhere

Copy link
Member Author

Choose a reason for hiding this comment

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

Good! It means you don't often hit our very high function line limit

too-many-lines-threshold = 600 # TODO(emilk): decrease this

Comment on lines +168 to +169
let id = egui::Id::new((archetype_name, field.display_name));
ui.markdown_ui(id, field.docstring_md);
Copy link
Member

Choose a reason for hiding this comment

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

It seems that markdown ui somehow adds a lot of space on top and bottom of the hover ui. Is that intentional? Looks like a bug, orthogonal to this PR

image

Before:
image

Copy link
Member Author

Choose a reason for hiding this comment

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

@emilk emilk merged commit d7368f7 into main Jun 25, 2024
35 of 36 checks passed
@emilk emilk deleted the emilk/archetype-reflection branch June 25, 2024 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen/idl exclude from changelog PRs with this won't show up in CHANGELOG.md 🚜 refactor Change the code, not the functionality ui concerns graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor: merge ArchetypeFieldInfo into the reflection module
2 participants