How to include Javadoc and source code with dependency

Viewed 850

I currently use the JSoup dependency into Visual Studio Code, but I don't have the Javadoc or the source code of Jsoup in my Visual Studio Code:

The dependency

    <dependency>
      <!-- jsoup HTML parser library @ https://jsoup.org/ -->
      <groupId>org.jsoup</groupId>
      <artifactId>jsoup</artifactId>
      <version>1.13.1</version>
    </dependency>

The result

JavaDoc

enter image description here

The javadoc is not shown

Source

enter image description here

The source is not shown

Question

Do you have any idea to solve this problem?

The JavaDoc and Sources of JSoup dependency are available here: https://repo1.maven.org/maven2/org/jsoup/jsoup/1.13.1/

JSoup included the Javadoc in their code: https://github.com/jhy/jsoup/blob/master/src/main/java/org/jsoup/nodes/Document.java

3 Answers

Do this:

<dependency>
  <!-- jsoup HTML parser library @ https://jsoup.org/ -->
  <groupId>org.jsoup</groupId>
  <artifactId>jsoup</artifactId>
  <version>1.13.1</version>
</dependency>
<dependency>
  <!-- jsoup HTML parser library @ https://jsoup.org/ -->
  <groupId>org.jsoup</groupId>
  <artifactId>jsoup</artifactId>
  <version>1.13.1</version>
  <classifier>sources</classifier>
</dependency>
<dependency>
  <!-- jsoup HTML parser library @ https://jsoup.org/ -->
  <groupId>org.jsoup</groupId>
  <artifactId>jsoup</artifactId>
  <version>1.13.1</version>
  <classifier>javadoc</classifier>
</dependency>

In VS Code v1.68.1 my javadocs for some reason stopped showing up and navigating to definition showed the disassembled sources instead of the packaged sources. Enabling the settings depicted below restored the javadocs and sources I was expecting.

Setting IDs

java.eclipse.downloadSources
java.maven.downloadSources

enter image description here

There's no way to achieve your goals because the jar or dependency itself doesn't have the docstring.

For example, when you click into println, the comment part is also the content when you hover over the println:

enter image description here

But there's no such comment in jsoup, so java extension won't be able to catch the docstring and show it.

[UPDATE]

jsoup/src/main/java/org/jsoup/nodes/Document.class: enter image description here

The files included in jar are all compiled to .class file, there's no comments before functions, so Java language server can't catch it to show as the feature intellisense.

Related