Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion item javadoc does not have links #731

Closed
tsmaeder opened this issue Jul 20, 2018 · 4 comments
Closed

Completion item javadoc does not have links #731

tsmaeder opened this issue Jul 20, 2018 · 4 comments

Comments

@tsmaeder
Copy link
Contributor

In Javadoc hovers, jdt.ls includes links for stuff like "@Seealso java.lang.Object". However, in the javadoc delivered in the "additionalInformation" of completion items, no such links are present. I don't really see a reason why not.

@fbricon
Copy link
Contributor

fbricon commented Jul 25, 2018

Do you have a concrete example?
Ok I see now, in the documentation.value field.

Given:

public class App {
    public static void main( String[] args )
    {
        fo|<completion here>
    }


    /**
     * Hello world!
     *
     * @see Object
     */
    public static void foo() {}

}

the server returns:

[Trace - 10:40:40] Received response 'completionItem/resolve - (47)' in 8ms.
Result: {
    "label": "foo() : void",
    "kind": 3,
    "detail": "App",
    "documentation": {
        "kind": "markdown",
        "value": "Hello world!\n\n *  **See Also:**\n    \n     *  Object"
    },
    "sortText": "999999163",
    "insertText": "foo",
    "insertTextFormat": 2,
    "textEdit": {
        "range": {
            "start": {
                "line": 12,
                "character": 8
            },
            "end": {
                "line": 12,
                "character": 9
            }
        },
        "newText": "foo();"
    }
}

while hover yields:

[Trace - 10:45:20] Received response 'textDocument/hover - (159)' in 20ms.
Result: {
    "contents": [
        {
            "language": "java",
            "value": "void foo.bar.App.foo()"
        },
        "Hello world!\n\n *  **See Also:**\n    \n     *  [Object](jdt://contents/java.base/java.lang/Object.class?=jaaavaten/%5C/Library%5C/Java%5C/JavaVirtualMachines%5C/jdk-10.0.1.jdk%5C/Contents%5C/Home%5C/lib%5C/jrt-fs.jar%60java.base%3Cjava.lang%28Object.class#39)"
    ]
}

@fbricon
Copy link
Contributor

fbricon commented Jul 25, 2018

No idea why Markdown is generated differently (provided the client declares it supports it). One would need to dig into https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionResolveHandler.java#L138.

@JPinkney implemented Markdown link generation, so he might be able to give more precise pointers

@JPinkney
Copy link
Contributor

I haven't looked into this but it might be as simple of a fix as changing https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionResolveHandler.java#L138 to using JavadocContentAccess2.getMarkdownContentReader like hover does

@fbricon
Copy link
Contributor

fbricon commented Jul 25, 2018

@JPinkney nice catch, it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants