Show feature code for code annotations and file annotations #129
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.
Description
We modified the multiResolve method in FeatureReference.java to modify the find Usages functionality on a feature. This works differently on different type of feature references:
FolderAnnotation: Do nothing
CodeAnnotations: We ignore end tags to avoid redundant results. Additionally we retrieve the line numbers and create a custom PsiElement with the new name ("FeatureName: beinLineNumber-endLineNumber"), but the new name is not shown in the find usages tab.
FileAnnotations: For file annotations we look through the .feature-to-file and detect all files that the current feature is connected with. We then create ResolveResults out of those files and return them. The problem is that those files as ResolveResults are not shown, when we do find usages in general, but only when we do it in the .feature-to-file file. Interestingly when we debugged our solution, when calling find usages from somewhere else, the code searching for the files is still executes and finds the correct files and adds them to the result, but these are not shown in the find Usages result tab. (When and where correct results can be seen, is shown in the video.
Originally we wanted to use the FeatureLocationManager to find all FeatureLocations for the current feature, but the reference search inside it, calls our multiResolve method subsequently, causing an infinite recursion. We tried putting it to a background task and also asked in the forum (https://platform.jetbrains.com/t/long-running-reference-search-in-psireference-multiresolve-method/624), but nothing worked. Thats why we stuck with our original solution. Parts of the solution with the FeatureLocationManager can still be found in the main branch of our fork.
Related Issue
#44
Motivation and Context
How Has This Been Tested?
We tried testing the find Usages as can be seen in the video, but it has the aforementioned limitations
Demo
show_feature_code.mp4
Types of changes
Further issues
There are still the two problems with the results not showing correctly mentioned in the description.
Checklist: