Repository navigation
goto definition for beans and methods references in spel expressions - #1360
Conversation
|
Some newly created files are missing copyright statements at the top. Can you add them? |
164c6cd to
988c0d9
Compare
| IAnnotationBinding binding = a.resolveAnnotationBinding(); | ||
| if (binding != null && binding.getAnnotationType() != null | ||
| && Annotations.VALUE.equals(binding.getAnnotationType().getQualifiedName())) { | ||
| return parseSpelAndFetchLocation(cancelToken, project, cu, offset); |
There was a problem hiding this comment.
I think I was looking at this PR in the past and just didn't look closely enough :-
I think I like everything except this piece. We're only interested in this literal the cursor is at and nothing else. At this point whatever parseSpelAndFetchLocation(...) is doing is wrong. No need to visit the CU and find all possible SPEL expressions and collect them. Instead of CU you should really visit just one single annotation.
Anyway, I'd try to extract SPEL Region from the found annotation a (line 101). Once you have the Region check that offset paremter is within that region. If yes, then:
List<TokenData> beanReferenceTokens = computeTokens(snippet, offset);
if (beanReferenceTokens != null && beanReferenceTokens.size() > 0) {
locationLink.addAll(findLocationLinksForBeanRef(project, offset, beanReferenceTokens));
}
Optional<Tuple2<String, String>> result = parseAndExtractMethodClassPairFromSpel(snippet,
offset);
result.ifPresent(tuple -> {
locationLink.addAll(findLocationLinksForMethodRef(tuple.getT1(), tuple.getT2(), project));
});
There was a problem hiding this comment.
Yes, this makes sense. Thanks for pointing this out. Removed the unnecessary parsing logic.
02ed5ae to
64d5411
Compare
64d5411 to
b0743ff
Compare
No description provided.