Repository navigation
mcgui/mxgui: show parameter docs in Insert Component dialog again - #3218
Merged
Merged
Conversation
ComponentParser matched no parameter docs since 028b69f, so the dialog showed none. Take them from parse_header, as mcdoc does. Also strip the type from parameters without a default value ("string filename"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Free-form text area
The Insert Component dialog in mcgui and mxgui has shown no parameter descriptions since 028b69f (Oct 2025, first in v3.5.38). In
ComponentParser.__matchDocStringsToPars, the pattern^(.*)([\[\w\s\]])(.*)$takes the whole line except its last character as the parameter name, so no name ever matched.Fix in
mccodelib/utils.py:ComponentParsernow takes the parameter docs fromparse_header, the parser that mcdoc andmccode-check-doc-paramsuse. The first entry wins, as in mcdoc, and the text is shown as[unit] doc. The old matcher and its helper are removed.string filename), so it never matched a doc either. The type is now split off. This affected 25 components.Tests (macOS arm64,
mccode-devenv):ComponentParseron all 661 McStas and McXtrace components: all parse, and every parameter has a description (before: none had one).utils.py(mxguiMirror_toroid, mcguiText). Before: all descriptions blank, andText's first label readsstring text:. After:text:with[str] Text to draw., and every other parameter shows its description too.Not tested: the full GUI run interactively, Linux and Windows.
Declaration of use of AI-tools
Co-Authored-Byline naming the tool, see CONTRIBUTING.mdDevelopment OS / boundary conditions
macOS arm64, micromamba
mccode-devenvironment.PR Checklist for contributing to McStas/McXtrace
My contribution contains something else
mccodelib/utils.py)Tip for reviewers: Visit
https://blueblazin.github.io/blockviz/#github=[URL_of_this_PR]for a visual look at code changes🤖 Generated with Claude Code