Skip to content

Show simple class names on blocks#397

Merged
lizlooney merged 6 commits intowpilibsuite:mainfrom
lizlooney:pr_showSimpleClassNames
Apr 21, 2026
Merged

Show simple class names on blocks#397
lizlooney merged 6 commits intowpilibsuite:mainfrom
lizlooney:pr_showSimpleClassNames

Conversation

@lizlooney
Copy link
Copy Markdown
Collaborator

This feature is on by default, but the user can change it from the Settings menu.

I ran through the checklist.

I also tested it with a project that uses all the types of blocks that show class names:
With full names:
Screenshot 2026-04-19 at 10 06 42 PM
With simple names:
Screenshot 2026-04-19 at 10 06 57 PM

Modify TabContent to call Editor.updateShowSimpleClassNames when showSimpleClassNames is changed.

Add updateShowSimpleClassNames to Editor.
Editor calls mrcShowSimpleClassNames on blocks that have that function when blocks are loaded, created, and when showSimpleClassNames is changed.
Toolbox blocks are also updated when showSimpleClassNames is changed.
…component, mrc_get_python_enum_value, mrc_get_python_variable, and mrc_set_python_variable):

Use a mixin member instead of the value of the field that shows the class name, for tooltip, generating python code, etc.
Added mrcShowSimpleClassNames to update the value of the field that shows the class name according to showSimpleClassName.
Added showSimpleClassNames parameter to functions that create blocks and use it when setting the field that shows the class name.

mrc_call_python_function.ts:
Added moduleOrClassName to CallPythonFunctionExtraState and mrcModuleOrClassName to CallPythonFunctionMixin, since the FIELD_MODULE_OR_CLASS_NAME field value might not be the full class name.
Added upgrade_0012_to_0013 to set mrcModuleOrClassName.

mrc_component.ts:
Added className to ComponentExtraState and mrcClassName to ComponentMixin, since the FIELD_TYPE field value might not be the class name.
Added upgrade_0012_to_0013 to set mrcClassName.

mrc_mechanism.ts:
Pass showSimpleClassName to valueForComponentArgInput since it might create an mrc_get_python_enum_value block.
@lizlooney lizlooney requested a review from alan412 April 20, 2026 05:08
Copy link
Copy Markdown
Collaborator

@alan412 alan412 left a comment

Choose a reason for hiding this comment

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

LGTM. At first, I didn't like the check mark in front, but that is what Apple does. I wonder if there is some way we could show an "empty" icon so the line doesn't move in or out. But I think that is a minor nit and something we could deal with later.

@lizlooney lizlooney merged commit 2b7db76 into wpilibsuite:main Apr 21, 2026
1 check passed
@lizlooney lizlooney deleted the pr_showSimpleClassNames branch April 21, 2026 02:38
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.

2 participants