【问题标题】:Javadoc not showing on hover in VSCodeJavadoc not showing on hover in VSCode
【发布时间】:2022-11-09 11:30:39
【问题描述】:

I'm currently working on a java project using VSCode and when I hover an object, type or method name, documentation isn't showing anymore. I do not know why or what I did to change that.

In the following picture, I am hovering the first occurence of ByteBuyUtils, and as we can see, nothing is shown.

first hovering example

Here is a picture found on google pictures showing what I want to get when hovering something :

example of what I want when hovering code

I'm using 1.65.1 version of VSCode, on Ubuntu 21.10. I am using openjdk version "18-ea" 2022-03-15.

The following extensions are installed on my VSCode :

  • Language Support for Java(TM) by Red Hat
  • Debugger for Java
  • Test Runner for Java
  • this is a editor problem!!
  • Yes, probably, but this doesn't change the fact that I don't know how to fix it
  • just search for a java extension in vscode extensions, and install it
  • I edited the post
  • Sometimes Test Runner for Java will have some conflicts with Red Hat extension, can you uninstall the extension "Test Runner for Java" and restart VS Code to see if it works?

标签: java visual-studio-code javadoc


【解决方案1】:

Maybe this is the extension you need:Visual Studio IntelliCode You can also read this article to see some of the extensions that Java needs: https://code.visualstudio.com/docs/java/java-tutorial

  • I installed the extension Visual Studio IntelliCode but it didn't change anything. I will try searching in the java-tutorial from VSCode doc. Thanks !
  • @Arthur Have you solved the problem now? If not, I think you can provide more information for me to understand the specific situation
  • Thanks for your response, I found the source of the problem and it has nothing to do with VSCode, I am currently working on finding a solution.
【解决方案2】:

It stands to reason that the extension you downloaded has this function to show that... why don't you install an intelligent prompt extension such as this oneto have a try? Or please check it out if you have turned off the setting:editor.hover.enabled(in the lower right corner and search for hover)?

  • This setting has always been turned on, also I installed Visual Studio IntelliCode but it didn't change anything. Thank you for your answer !
  • I'm sorry to hear that. To remedy the situation, I'm getting this again:link, hope this helps.
【解决方案3】:

You may try a couple of things.

maven

If you are using maven, you need to explicitly download javadoc and source of the packages in your project.

  • To download source code: mvn dependency:sources
  • To download javadoc: mvn dependency:resolve -Dclassifier=javadoc

java home property

In vscode, you need to set java home property.

  • Ctrl+Shift+p to open command palette
  • search for user settings json
  • the settings.json should be opened
  • add a field java.jdt.ls.java.home and set the value to the root folder of your openjdk package.

For me, it's /usr/lib/jvm/java-17-openjdk-amd64. So I add

"java.jdt.ls.java.home": "/usr/lib/jvm/java-17-openjdk-amd64"

to the settings.json

install openjdk javadoc

You can download the doc of your openjdk version via. apt on Ubuntu.

$ sudo apt update
$ apt list | grep openjdk-17-

You should see openjdk-17-doc and openjdk-17-source available. Change 17 to your version of choice (18 for example). Then

$ sudo apt install openjdk-17-doc openjdk-17-source

Finally

Restart vscode

    猜你喜欢
    • 2022-12-02
    • 2022-12-01
    • 2022-12-27
    • 2022-12-26
    • 2022-12-01
    • 2022-12-27
    • 2022-11-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多