1

I want to import the JavaFX docs to VSCode so that it displays the docs in tooltips like with other methods. The link to JavaFX docs is- https://openjfx.io/javadoc/15/ But I don't know how to add it the VSCode

I want the method docs to be visibly like this

2 Answers 2

1

I found an indirect way to do this. We can add the documentation path to the .classpath file of the project. We have to do it manually as there is no way to do this automatically yet.

<classpath>
    <classpathentry kind="lib" path="lib/javafx.base.jar">
        <attributes>
            <attribute name="javadoc_location" value="https://docs.oracle.com/javafx/2/api/"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="lib" path="lib/javafx.controls.jar">
        <attributes>
            <attribute name="javadoc_location" value="https://docs.oracle.com/javafx/2/api/"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="lib" path="lib/javafx.fxml.jar">
        <attributes>
            <attribute name="javadoc_location" value="https://docs.oracle.com/javafx/2/api/"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="lib" path="lib/jfoenix-9.0.10.jar">
        <attributes>
            <attribute name="javadoc_location" value="https://javadoc.io/static/com.jfoenix/jfoenix/9.0.10/"/>
        </attributes>
    </classpathentry>
</classpath>
0

Do you mean that you want to get JavaFX docs like this:

enter image description here

You can achieve this by inserting new snippets:

  1. Press Ctrl+Shift+P to open Command Palette and select Preference: Configure User Snippets, then choose New Global Snippets file;

  2. Enter snippet name and there will be a file opened, add the following code to it:

     "JavaFX": {
             "prefix": "javafx-doc",
             "body": [
                 "https://docs.oracle.com/javafx/2/api/index.html"
             ],
             "description": "javaFX Doc"
         }
    
  3. When you type the prefix javafx-doc in .java file, this will show as snippets.

More detailed information about Snippets, you can refer to Creating own Snippets in VS Code. If there's any misunderstanding about your question, please let me know.

4
  • 1
    I am not trying to create snippets but I want the actual documentation to be visible for methods and classes like the documentation for printf() is visible in the image Oct 30, 2020 at 7:29
  • So you want when you type func(), which we assume it's a function in the javafx-docs, then there will be the related information displayed in the block? Oct 30, 2020 at 7:58
  • Yes, that's exactly what I am trying to do. I can do this in eclipse but I don't know how to do it in VSCode Oct 30, 2020 at 11:24
  • The docs which can be shown in eclipse is provided by the JDK you installed and not the official link. If the JDK in Eclipse is the same one in VS Code, call a function at will, then Ctrl+Click to see if there's description before class, if there is, the extension Language Support for Java(TM) by Red Hat will get them displayed in the block. if there're no detailed information there, there won't docs displayed. So this question may be solved by installing a jdk with docs in jar. Nov 2, 2020 at 3:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.