Home > database >  Java Documentation from Vscode
Java Documentation from Vscode

Time:09-18

Hey I am using the Spring tool suite for Vscode It's working great but there is one thing I am missing like in other IDE's you can view the documentation for a specific Annotation or method. for example:

If I try to view the documentation for any annotation in intellij it shows the documentation properly, but if i try to do the same on vscode it shows up like this:

enter image description here

CodePudding user response:

This message says that VS Code couldn't find the JAR archive that contains source files for this class. These JARs usually are called XYZ-sources.jar. You need to download an archive like that manually or use the Maven plugin that can download it for you.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>3.2.0</version>
    <executions>
        <execution>
            <id>src-dependencies</id>
            <phase>package</phase>
            <goals>
                <goal>sources</goal>
            </goals>
            <configuration>
                <silent>true</silent>
            </configuration>
        </execution>
    </executions>
</plugin>

Then, if you have downloaded JAR archive you need to press Right Mouse Button -> Attach Source.

enter image description here

CodePudding user response:

You can enable the setting java.maven.downloadSources.

Then each time you opened a class file, if the source jar does not exist locally, the extension will trigger a download task for that source jar. After that, next time you open that class file, you can see the source.

  • Related