New loader C# bugfixes and improvements#3032
Conversation
|
Unable to trigger custom agent "Code Reviewer"You have run out of credits 😔 |
There was a problem hiding this comment.
Pull request overview
Addresses loader/parser issues in the new C# loader by improving Python constant parsing, fixing extension root discovery from config, and adding first-class “Help URL” (F1 contextual help) support for commands.
Changes:
- Extend Python script constant parsing to correctly ignore trailing comments and support
__helpurl__dictionaries. - Add
helpurl/helpurlssupport to bundle parsing and propagate it through parsed component models; apply F1 contextual help during ribbon item post-processing. - Update extension root discovery to use
pyRevit_config.iniparsing (UserExtensionsList) instead of manual line scanning.
Reviewed changes
Copilot reviewed 7 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| dev/pyRevitLoader/pyRevitExtensionParserTester/PanelButtonBundleTests.cs | Adds a regression test ensuring trailing comments don’t pollute parsed script metadata (e.g., __title__). |
| dev/pyRevitLoader/pyRevitExtensionParser/ParsedComponent.cs | Adds HelpUrl + localized help URL support to parsed UI components. |
| dev/pyRevitLoader/pyRevitExtensionParser/ParsedBundle.cs | Adds HelpUrl and HelpUrls (localized) to the bundle model. |
| dev/pyRevitLoader/pyRevitExtensionParser/ExtensionParser.cs | Updates extension root discovery and wires help URL parsing/merging from scripts + bundle.yaml; improves string constant extraction to ignore trailing comments. |
| dev/pyRevitLoader/pyRevitExtensionParser/BundleParser.cs | Adds helpurl / helpurls parsing support in bundle.yaml. |
| dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/Buttons/PanelButtonBuilder.cs | Documents contextual-help behavior for dialog launcher conversion. |
| dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/Buttons/ButtonPostProcessor.cs | Applies contextual help (F1 URL) to created ribbon items. |
| bin/netfx/engines/IPY342/pyRevitExtensionParser.dll | Updates the shipped parser assembly for the IPY342 engine build. |
Comments suppressed due to low confidence (1)
dev/pyRevitLoader/pyRevitExtensionParser/ExtensionParser.cs:751
- Template substitution is applied to
scriptHelpUrlbut not tobundleInComponent.HelpUrlnor tofinalLocalizedHelpUrls. This meanshelpurl/helpurlsvalues containing{{...}}templates won’t resolve (and may later fail URL validation). ApplySubstituteTemplatesto the bundleHelpUrland runSubstituteTemplatesInDictonfinalLocalizedHelpUrlsthe same way titles/tooltips are handled.
// Apply template substitution to string values
title = SubstituteTemplates(title, mergedTemplates);
doc = SubstituteTemplates(doc, mergedTemplates);
author = SubstituteTemplates(author, mergedTemplates);
var hyperlink = SubstituteTemplates(bundleInComponent?.Hyperlink, mergedTemplates);
scriptHelpUrl = SubstituteTemplates(scriptHelpUrl, mergedTemplates);
// Apply template substitution to localized values
finalLocalizedTitles = SubstituteTemplatesInDict(finalLocalizedTitles, mergedTemplates);
finalLocalizedTooltips = SubstituteTemplatesInDict(finalLocalizedTooltips, mergedTemplates);
|
@romangolev can you review the 3 comments from ghcopilot, please? |
Test 1This works: 🚀 🟢
__title__ = " _ variable title _ "
__context__ = "zero-doc"
__authors__ = ["jmc", "John Doe"]
__helpurl__ = {"en_us": "https://www.nytimes.com", "fr_fr": "https://www.lemonde.fr"}
__doc__ = {"en_us": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "fr_fr": "Lorem tooltip en francais"}
print("Complex Push Button jm")this doesn't: helpurls = {"en_us": "https://www.nytimes.com", "fr_fr": "https://www.lemonde.fr"} expected? @romangolev Test 2 🟢bundle.yaml with multiple help url per language
Test 3 🟢
Note
|
Not sure if helpurls and help_urls from bundle should be supported. Haven't found any evidence of them on notion not here nor there. I decided to stick to the helpurl and help_url to handle both singular and multilang support |
I am on this one now @jmcouffin |
Sounds good to me! |
|
@jmcouffin I am on a hot streak 😀 |
Sounds like Duolingo! 🤣😁🤭 |
dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/Buttons/ButtonPostProcessor.cs
Outdated
Show resolved
Hide resolved
|
got few errors, while testing the PR: I see the naming of the scripts are fixed and the custom extensions also being fixed, Good Job @romangolev |
|
@tay0thman thanks for review!
Haven't noticed the same behavior on my end. Could be that the app uses old dlls. Try to wipe out all the files from |
__min_revit_ver__, __max_revit_ver__, __beta__, __cleanengine__, __fullframeengine__, __persistentengine__
|
@jmcouffin I've been scouting through the docs and found that the new loader implementation lacks the inline support for some of the features. Even though most tools are bundle-driven, I had to add them to make app as backwards compatible as possible. New Script Variables Supported
A small fix and refactor for the locale module. Nothing fancy as the main locale stays in python. |
This worked, no issues here. I'll keep testing but this seems to be a solid PR. |
|
@tay0thman you got the point! |
That Works! Awesome! Thank you @romangolev One more Item I noticed in the Bundle Metadata, the "before: " & "after: " arguments are not supported by the new loader |
|
📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1738-wip |
|
📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1743-wip |
|
📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1829-wip |
|
📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1937-wip |
|
📦 New work-in-progress (wip) builds are available for 6.0.0.26032+1956-wip |
|
📦 New work-in-progress (wip) builds are available for 6.0.0.26032+2005-wip |
|
📦 New work-in-progress (wip) builds are available for 6.0.0.26032+2008-wip |
|
📦 New public release are available for 6.0.0.26032+2040 |
|
📦 New public release are available for 6.0.0.26032+2040 |




New loader C# bugfixes and improvements
Description
Address #2995 Task and pursue the effort of bug elimination.
This PR fixes:
#3024
#3023
Also adds support for Help URL:
https://pyrevitlabs.notion.site/Anatomy-of-IronPython-Scripts-f11d0099667f46a28d29b028dd99ccaf#fee25dbae69b419489e2fd168fbb2876
Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}Related Issues
If applicable, link the issues resolved by this pull request:
Additional Notes
Include any additional context, screenshots, or considerations for reviewers.
Thank you for contributing to pyRevit! 🎉