-
Notifications
You must be signed in to change notification settings - Fork 373
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
Extract embedded javadoc images #1138
Conversation
Can one of the admins verify this patch? |
add to whitelist |
@fbricon This is how I did it for the javadoc jar https://github.com/eclipse/eclipse.jdt.ls/pull/1138/files#diff-b3a48af05d56183bee79e67754caeb7aR136 Am I on the right track, and how would I do it for the source jar? Thanks. |
I removed it from the whitelist to allow for absolute local paths to work as well, but I realised that case won't happen. Will revert it. Also still need to handle some URI/OS specific path things. You don't have to check those things yet. |
1a04501
to
de255b3
Compare
@NikolasKomonen "add to whitelist" is a command to add you to Jenkins' whitelist, so that your PRs are automatically built ;-) |
test this please |
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 tested https://github.com/reactor/reactor-core and get the following error:
[Error - 12:15:21 AM] Aug 2, 2019 12:15:21 AM Error computing hover
null
java.lang.NullPointerException
at java.io.File.<init>(File.java:277)
at java.util.jar.JarFile.<init>(JarFile.java:103)
at org.eclipse.jdt.ls.core.internal.javadoc.JavaDocHTMLPathHandler.getValidatedHTMLSrcAttribute(JavaDocHTMLPathHandler.java:149)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.handleContentElements(JavadocContentAccess2.java:1465)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.handleContentElements(JavadocContentAccess2.java:1436)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.elementToHTML(JavadocContentAccess2.java:1095)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.toHTML(JavadocContentAccess2.java:934)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.javadoc2HTML(JavadocContentAccess2.java:845)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.getHTMLContentFromSource(JavadocContentAccess2.java:729)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:587)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.getMarkdownContentReader(JavadocContentAccess2.java:2498)
at org.eclipse.jdt.ls.core.internal.HoverInfoProvider.computeJavadoc(HoverInfoProvider.java:252)
at org.eclipse.jdt.ls.core.internal.HoverInfoProvider.computeHover(HoverInfoProvider.java:133)
at org.eclipse.jdt.ls.core.internal.handlers.HoverHandler.computeHover(HoverHandler.java:50)
at org.eclipse.jdt.ls.core.internal.handlers.HoverHandler.hover(HoverHandler.java:39)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$6(JDTLanguageServer.java:514)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$41(JDTLanguageServer.java:909)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
@NikolasKomonen You can explore org.eclipse.jdt.ui.StandardJavaElementContentProvider
d832f45
to
b36522e
Compare
@NikolasKomonen you can try the following:
|
@NikolasKomonen you should also test the source package fragments:
You will get an exception. |
08cf8ce
to
7d6b2ab
Compare
@snjeza I've fixed the issues with this PR. Would you be able to check this when you have time? |
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Outdated
Show resolved
Hide resolved
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Show resolved
Hide resolved
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Outdated
Show resolved
Hide resolved
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Show resolved
Hide resolved
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Outdated
Show resolved
Hide resolved
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Outdated
Show resolved
Hide resolved
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Outdated
Show resolved
Hide resolved
96ce7d3
to
28786ae
Compare
@fbricon Updated and tested on Windows as well. |
28786ae
to
cfd2549
Compare
still doesn't work on my mac. It used to work, in your previous patches. Might be some change in the way javadoc is computed/sent to the new code, which breaks it |
doesn't work on my linux box either. Tested with a bunch of reactor-core versions. |
No, it doesn't. |
@NikolasKomonen so it works when hovering over |
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Outdated
Show resolved
Hide resolved
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Show resolved
Hide resolved
I have faced the following issue:
See microsoft/vscode#45260 (comment) |
@snjeza I'm not able to re-create your issue. Was it always happening or did it appear randomly? Also, are you running the most recent (August) Vscode version? |
@snjeza Ok I see the issue and can recreate it, but are you having the same issue with loading the image on hover? It could be that the permissions are different for language server hovers compared to using the mardown preview feature. |
I can't reproduce that, I'm using the latest VS Code insiders. I still see the problem of the missing image when hovering on |
oh but I can reproduce it in regular vscode. |
It works now. |
cfd2549
to
74b5a04
Compare
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Outdated
Show resolved
Hide resolved
...eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDocHTMLPathHandler.java
Outdated
Show resolved
Hide resolved
This PR solves the issue when the image linked in the javadoc points to a location inside the jar. Fixes eclipse-jdtls#1007 Signed-off-by: Nikolas Komonen <nikolaskomonen@gmail.com>
74b5a04
to
799e9a0
Compare
Thanks @NikolasKomonen ! |
The purpose of this PR is to enable javadoc hover to work with html tag images that are embedded inside a jar. This does not currently work because the language server receives a relative path to the jar that it does not know how to resolve.
This PR will extract the image into the jdtls plugin folder and replace the html img tag 'src' attribute with the new path.
Image extraction works, regular paths work too.
No tests.
Need to figure out how to get path of source jar.
Fixes redhat-developer/vscode-java#1007