-
Notifications
You must be signed in to change notification settings - Fork 206
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
goto definition for beans and methods references in spel expressions #1360
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.