Skip to content

JDT.LS hover shows class name only instead of full method signature#3699

Open
subyssurendran666 wants to merge 2 commits intoeclipse-jdtls:mainfrom
subyssurendran666:javadoc_hover_show_full_signature_3690
Open

JDT.LS hover shows class name only instead of full method signature#3699
subyssurendran666 wants to merge 2 commits intoeclipse-jdtls:mainfrom
subyssurendran666:javadoc_hover_show_full_signature_3690

Conversation

@subyssurendran666
Copy link
Contributor

On mouse hover, Markdown links can display the full constructor or method signature as the anchor text, which provides more context to users

Fix: #3690

Test Snippet

public class Apple{
	/// {@link Ball#xxx}
	void zoo(){}
	/// {@link Ball#abc()}
	void voo(){}
	/// {@link Ball#Ball}
	void voo1(){}
	/// {@link Ball#Ball(int x)}
	void voo2(){}
	/// {@link Ball#Ball(String y)}
	void voo3(){}

	/// {@link #newMethodBeingLinkedToo}
	void voo4(){}

	/// {@link #newMethodBeingLinkedToo()}
	void voo5(){}

	/// {@link Ball#Ball(String y, int i, Double x)}
	void voo6(){}

	/**
	 * {@link Ball#Ball(String y, int i, Double x)}
	 */
	void voo7(){}

	void newMethodBeingLinkedToo(){}
}
class Ball{
	private String xxx;
	Ball(int x){}
	Ball(String y){}
	void abc(){}
}

On mouse hover, Markdown links can display the full constructor or
method signature as the anchor text, which provides more context to
users

Fix: eclipse-jdtls#3690
Comment on lines 1153 to 1177
buf.append("package test;\n"
+ "public class Apple {\n"
+ " /// {@link Ball#xxx}\n"
+ " void foo(){}\n"
+ " /// {@link #newMethodBeingLinkedToo()}\n"
+ " void foo1(){}\n"
+ " /// {@link Ball#abc()}\n"
+ " void voo(){}\n"
+ " /// {@link Ball#Ball}\n"
+ " void voo1(){}\n"
+ " /// {@link Ball#Ball(int x)}\n"
+ " void voo2(){}\n"
+ " /// {@link Ball#Ball(String y)}\n"
+ " void voo3(){}\n"
+ " /// {@link Ball#Ball(String y, int i, Double x)}\n"
+ " void voo4(){}\n"
+ " void newMethodBeingLinkedToo(){}"
+ "}\n"
+ "class Ball {\n"
+ " private String xxx;\n"
+ " Ball(int x){}\n"
+ " Ball(String y){}\n"
+ " void abc(){}\n"
+ "}"
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use text block (""")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

enum HoverSignatureCase {
FIELD_REF("Ball.xxx", 3, 9), SELF_METHOD("newMethodBeingLinkedToo()", 5, 9), METHOD_REF("Ball.abc()", 7, 9), CTOR_REF("Ball.Ball", 9, 9), CTOR_X("Ball.Ball(int x)", 11, 9), CTOR_Y("Ball.Ball(String y)", 13,
9), CTOR_MANY("Ball.Ball(String y, int i, Double x)", 15, 9);
FIELD_REF("Ball.xxx", 3, 9), SELF_METHOD("newMethodBeingLinkedToo()", 6, 9), METHOD_REF("Ball.abc()", 9, 9), CTOR_REF("Ball.Ball", 12, 9), CTOR_X("Ball.Ball(int x)", 15, 9), CTOR_Y("Ball.Ball(String y)", 18,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please format the enum values so it's more readable, eg. 1 per line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@subyssurendran666 subyssurendran666 force-pushed the javadoc_hover_show_full_signature_3690 branch from d4f0dfc to e464065 Compare January 30, 2026 11:46
Copy link
Contributor

@fbricon fbricon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hover fails in this case:

/// See {@link Ball} for more information.
void linkToBall(){}

[Error - 3:54:07 PM] Jan 30, 2026, 3:54:07 PM Error computing hover
java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.collectLinkedTag(JavadocContentAccess2.java:240)

Same error with the following, that HTML Javadoc renders as plain text ("some text"):

/// {@link "some text"}
void method() {}

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.

JDT.LS hover shows class name only instead of full constructor/method signature

2 participants