5

In Intellij the shortcut for showing official Javadoc is CTRL+q. Any shortcut to do this in VSCode?

2
  • Ctrl+shift+p -> select javadoc generator Commented Nov 16, 2020 at 7:01
  • Press Ctrl and click a function or class can go into its .class file. If there're comments before code, the extension Language Support for Java(TM) by Red Hat will get them and when you hover up the function or class in .java file, the comment or we can call them docs will be displayed in a block, so when you go into .class, are there any comments or docs there? Commented Nov 17, 2020 at 6:23

4 Answers 4

2

There is an extension calls

Docs View which show you the docs in separate vs code window

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

1

to view the Java documentation in Visual Studio Code to you can do it by the following ways:

  1. mouse hover elements which you want to lookup
  2. after short version appears, press ctrl key twice (if you press ctrl key once, the long version documentation appears as long as you hold the ctrl key)

NOTE: if it didn't work you need to install the java extension path in your visual studio code which the extension id is: @id:vscjava.vscode-java-pack

visual studio code with Java code and related Java extension

2 Comments

unfortunately pressing ctrl once or twice doesn't show anything. my Vscode versoin is 1.51. @mustafa poya did you change something in the configuration or the settings of ur vscode to enable documentation?
@MahmoudEzzEldin try install this extension: @id:vscjava.vscode-java-pack and then you can view the documentation of every Java Class you want
1

VS Code have such capability but you may need to set a keyboard shortcut first. First go to the configure page:

enter image description here

Search Show Definition Preview Hover, you will see it, and just set a shortcut whatever you want:

enter image description here

Comments

1

If you would like to view documentation in a separate panel, there is an extension called Docs View. Simply set shortcuts for docsView.documentation.focus and workbench.action.togglePanel, position the cursor over the class, attribute or method and press the shortcut. Other useful commands are editor.action.showHover and editor.action.showDefinitionPreviewHover.

docs-view-preview

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.