-
-
Notifications
You must be signed in to change notification settings - Fork 15
Implement literal docstring merging from documentation into stub files with comprehensive test coverage #680
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #680 +/- ##
==========================================
+ Coverage 78.58% 78.68% +0.10%
==========================================
Files 70 70
Lines 6466 6546 +80
Branches 1079 1109 +30
==========================================
+ Hits 5081 5151 +70
- Misses 1034 1036 +2
- Partials 351 359 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot can you add a few test to validate the new behaviour ? |
Co-authored-by: Josverl <[email protected]>
f45e11d to
2b05008
Compare
I've added comprehensive test coverage for the new literal docstring merging functionality. The tests validate:
Added 5 new test cases specifically for literal docstring functionality plus updated 4 existing test cases to reflect the new behavior. All 77 merge tests now pass. Commit: 2e7c3c0 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…nality Co-authored-by: Josverl <[email protected]> Signed-off-by: Jos Verlinde <[email protected]>
2e7c3c0 to
5b2b1af
Compare
…eadability and maintainability Signed-off-by: Jos Verlinde <[email protected]>
Signed-off-by: Jos Verlinde <[email protected]>
Josverl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testing on the stubs repo gives good results , and improved stubs with additional infomation
Signed-off-by: Jos Verlinde <[email protected]>
Signed-off-by: Jos Verlinde <[email protected]>
Signed-off-by: Jos Verlinde <[email protected]>
This PR implements the ability to merge docstrings for literals/constants from documentation stubs into micropython stub files, enabling rich hover information in Pylance/VSCode. The implementation includes comprehensive test coverage to validate all aspects of the functionality.
Problem
Previously, when merging documentation stubs with firmware stubs, only function, method, and class docstrings were merged. Literal/constant docstrings were completely ignored, resulting in no hover documentation for important constants like
IPPROTO_UDP,Pin.IRQ_FALLING, etc.Solution
Added comprehensive literal docstring merging support at both module and class levels:
Module-level constants:
Class-level constants:
Implementation Details
AnnoValuedataclass withliteral_docstringsfield to store constant-docstring mappings_collect_literal_docstringsmethod toStubTypingCollectorthat detects assignment statements followed by string expressionsvisit_Moduleandvisit_ClassDefto collect literal docstrings from documentation stubsadd_missed_literal_docstringsmethod toMergeCommandthat merges collected docstrings into target stubsTest Coverage
Added comprehensive test suite with 5 new test cases covering:
CONST = value), annotated assignment (CONST: int = value), Final assignmentsAlso updated existing test cases to reflect the new functionality.
Benefits
Fixes #483.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.