Skip to content

Conversation

SimonOsterheider
Copy link

@SimonOsterheider SimonOsterheider commented Feb 28, 2025

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

  1. We want to get rid of redundant begin and end tags in the find usages result for code annotations.
  2. For file annotations we want to show the files connected to the feature in the find usages result view.

How Has This Been Tested?

  • Tests are created and passing
  • Manual testing
    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

  • Pipeline changes
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Further issues

There are still the two problems with the results not showing correctly mentioned in the description.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I have updated the CONTRIBUTORS file.
  • I have updated the CHANGELOG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants