-
Notifications
You must be signed in to change notification settings - Fork 33
fix: improve module finding logic by prioritizing subclass context for inherited API methods #615
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
…r inherited API methods
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
|
📦 Plugin has been packaged for this PR. You can download |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #615 +/- ##
===============================================
+ Coverage 53.879% 54.006% +0.127%
+ Complexity 2366 2350 -16
===============================================
Files 259 259
Lines 14707 13541 -1166
Branches 3254 3252 -2
===============================================
- Hits 7924 7313 -611
+ Misses 5339 4787 -552
+ Partials 1444 1441 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 157 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|
📦 Plugin has been packaged for this PR. You can download |
|
A PR (#616) has been opened to fix this issue. You can download the packaged plugin |
PR Type
Bug fix, Enhancement
Description
Improve module finding logic by prioritizing subclass context for inherited API methods
Add new overload
findModule(psiClass, psiMethod)to handle inherited methods correctlyChange
PsiResourceinterface methods to return non-nullable typesRefactor
DefaultModuleHelperto use named parameters and extract PsiResource handlingExpand test coverage with separate test methods for different parameter types
Diagram Walkthrough
File Walkthrough
DefaultFormatFolderHelper.kt
Simplify null-safe chaining logicidea-plugin/src/main/kotlin/com/itangcent/idea/plugin/api/export/core/DefaultFormatFolderHelper.kt
letblocksresource.resource()andresource.resourceClass()callschained optional handling
PsiResource.kt
Make PsiResource methods return non-nullable typesidea-plugin/src/main/kotlin/com/itangcent/idea/psi/PsiResource.kt
resourceClass()return type from nullablePsiClass?tonon-nullable
PsiClassresource()return type from nullablePsiElement?tonon-nullable
PsiElementModuleHelper.kt
Add class+method overload to ModuleHelper interfaceidea-plugin/src/main/kotlin/com/itangcent/idea/utils/ModuleHelper.kt
findModule(psiClass: PsiClass, psiMethod:PsiMethod)for explicit class+method resolutionclstopsiClassin existing method signature forconsistency
DefaultModuleHelper.kt
Add subclass-aware module resolution for inherited methodsidea-plugin/src/main/kotlin/com/itangcent/idea/utils/DefaultModuleHelper.kt
findModule(psiClass, psiMethod)to handleinherited methods with subclass context prioritization
findModule(psiResource)with special logic for PsiMethod resourcesfindModulemethod to use named parameters for clarityclstopsiClassfor consistency across all overloadsdealing with inherited methods
DefaultModuleHelperTest.kt
Expand tests with inherited method resolution coverageidea-plugin/src/test/kotlin/com/itangcent/idea/utils/DefaultModuleHelperTest.kt
baseControllerPsiClassfield to support testing inherited methodscenarios
testFindModule()into four focused test methods:testFindModuleWithString,testFindModuleWithPsiFile,testFindModuleWithPsiClass,testFindModuleWithPsiMethodtestFindModuleWithInheritedMethods()to verifysubclass context prioritization for inherited methods (issue #1267)
testFindModuleByPath()as separate test method for path-basedmodule resolution
BaseController.javain setUp to provide inherited method testdata
ConstantModuleHelper.kt
Update mock helper for new interface methodidea-plugin/src/test/kotlin/com/itangcent/mock/ConstantModuleHelper.kt
findModule(psiClass, psiMethod)in mockhelper
clstopsiClassfor consistency with interfacechanges