-
Notifications
You must be signed in to change notification settings - Fork 411
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
Add hover for package fragments #84
Add hover for package fragments #84
Conversation
Signed-off-by: Olivier Thomann <[email protected]>
// return computeSourceHover(curr); | ||
} | ||
IJavaElement curr = null; | ||
if (elements.length != 1) { |
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.
potential IIOOBE if length == 0, L54 and L58
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'll check that.
@@ -8,24 +8,35 @@ | |||
* Contributors: | |||
* IBM Corporation - initial API and implementation | |||
*******************************************************************************/ | |||
package copied.org.eclipse.jdt.ui; | |||
package org.jboss.tools.vscode.java.internal; |
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.
org.jboss.tools.vscode.java.internal.javadoc?
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.
OK, doable.
@@ -8,7 +8,7 @@ | |||
* Contributors: | |||
* IBM Corporation - initial API and implementation | |||
*******************************************************************************/ | |||
package copied.org.eclipse.jdt.internal.corext.javadoc; | |||
package org.jboss.tools.vscode.java.internal.hover; |
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.
org.jboss.tools.vscode.java.internal.javadoc?
package org.jboss.tools.vscode.java.internal; | ||
|
||
public class Util { | ||
|
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.
add private constructor if it's supposed to only contain static methods
|
||
public static String convertToIndependentLineDelimiter(String source) { | ||
if (source.indexOf('\n') == -1 && source.indexOf('\r') == -1) return source; | ||
StringBuffer buffer = new StringBuffer(); |
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.
please use a StringBuilder
Signed-off-by: Olivier Thomann <[email protected]>
Fix test Util class Signed-off-by: Olivier Thomann <[email protected]>
.filter(e -> e.equals(packageFragment)) | ||
.findFirst() | ||
.orElse(null); | ||
if (found == null) { |
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.
Why not imply test packageFragment.getKind() == IPackageFragmentRoot.K_BINARY?
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.
Because I think this is too early to check that. It can be a package from source as well if you import a type from another package. This is a case where it doesn't match the package from the current compilation unit.
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.
fair enough
Signed-off-by: Olivier Thomann <[email protected]>
adds pom.xml as workspaceContains activation Fixes eclipse-jdtls#84
I propose these changes to add some hover contents for a package fragment. This should work for the actual package declaration of the current unit if there is a package-info.java file in the same package or for import statements when you hover on the package part of the import.
Let me know what you think.
This also fixes the broken test on Windows.
I integrated all proposals from the previous PR (#83) that I closed by mistake.