-
Notifications
You must be signed in to change notification settings - Fork 408
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
Typing () returns wrong set of signatures (textDocument/signatureHelp) #1015
Conversation
@@ -80,6 +88,37 @@ public SignatureHelp signatureHelp(TextDocumentPositionParams position, IProgres | |||
return help; | |||
} | |||
|
|||
private boolean isValid(ICompilationUnit unit, int offset, IProgressMonitor monitor) { | |||
CompilationUnit ast = CoreASTProvider.getInstance().getAST(unit, CoreASTProvider.WAIT_YES, monitor); |
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.
instead of traversing the whole document, couldn't we find the closest enclosing node instead?
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 have updated the PR.
public boolean visit(MethodRef node) { | ||
if (node.getStartPosition() <= offset && (node.getStartPosition() + node.getLength()) >= offset) { | ||
valid[0] = true; | ||
} |
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.
once we found something, we should stop visiting the AST
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.
Fixed.
@Override | ||
public void endVisit(MethodInvocation node) { | ||
if (node.getStartPosition() <= offset && (node.getStartPosition() + node.getLength()) >= offset) { | ||
valid[0] = true; |
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.
will this method be called after visit(MethodRef) or they're really for 2 different node types?
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.
They are different node types.
org.eclipse.jdt.core.dom.MethodInvocation
Method invocation expression AST node type.
org.eclipse.jdt.core.dom.MethodRef
AST node for a method or constructor reference within a doc comment (Javadoc). The principal uses of these are in "@see" and "@link" tag elements, for references to method and constructor members.
I have added a new test.
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.
we don't need signature help in javadoc, or do we?
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.
It could be useful.
3a59f30
to
4450d9f
Compare
Signed-off-by: Snjezana Peco <snjezana.peco@redhat.com>
Fixes #1009
Signed-off-by: Snjezana Peco snjezana.peco@redhat.com