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

Java Suggestion Details doesn't work right sometimes. #1258

Closed
JoeyRxy opened this issue Feb 1, 2020 · 4 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#1353
Closed

Java Suggestion Details doesn't work right sometimes. #1258

JoeyRxy opened this issue Feb 1, 2020 · 4 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#1353

Comments

@JoeyRxy
Copy link

JoeyRxy commented Feb 1, 2020

Environment
  • Operating System: Win10 x64
  • JDK version: JDK13 or 11
  • Visual Studio Code version: 1.41.1
  • Java extension version: 0.55.1
Steps To Reproduce

I don't know whether other methods' suggestion detail is wrong, I found this bug just now in LinkedList.

  1. [step 1] make a instance list of LinkedList
  2. [step 2] type list.add. While you typing, suggestions pop up (or you can press Ctrl+Space). There should be details about method add which is generated from the method's JavaDoc, but there's not.
The ScreenShots



As we can see, details of method addAll works well, but there's no details about add. (As we know, add method in LinkedList does have a JavaDoc)

Current Result

add method in LinkedList does not have suggestion details

Expected Result

add method should have details. AND MORE IMPORTANT, perhaps there's a bug about suggestion details for JavaDoc.

@JoeyRxy
Copy link
Author

JoeyRxy commented Feb 1, 2020

The Screenshots :
the screen shot 1

2

3

@snjeza snjeza self-assigned this Feb 1, 2020
@JoeyRxy
Copy link
Author

JoeyRxy commented Feb 8, 2020

Hi? Does anyone notice this bug? I think we should attach importance to this bug of a primary function.

@anthonyvdotbe
Copy link

Another example:
image

@fbricon
Copy link
Collaborator

fbricon commented Feb 17, 2020

I can reproduce the issue with OpenJDK 13.0.1, both for List.add and Map.of().compute.

I can see completionItem/resolve doesn't return the javadoc for the List.add methods, but it works for List.addAll This is really, really weird.

[Trace - 10:31:04 AM] Received response 'textDocument/completion - (768)' in 12ms.
Result: {
    "isIncomplete": false,
    "items": [
        {
            "label": "add(int index, Object element) : void",
            "kind": 2,
            "detail": "List.add(int index, Object element) : void",
            "sortText": "999998971",
            "insertText": "add",
            "insertTextFormat": 2,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 15,
                        "character": 7
                    },
                    "end": {
                        "line": 15,
                        "character": 10
                    }
                },
                "newText": "add(${1:index}, ${2:element});"
            },
            "data": {
                "decl_signature": "Ljava.util.List<Ljava.lang.Object;>;",
                "signature": "(ILjava.lang.Object;)V",
                "name": "add",
                "pid": "0",
                "rid": "30",
                "uri": "file:///Users/fbricon/Dev/souk/standalones/max/src/foo/bar/Demo.java"
            }
        },
        {
            "label": "add(Object e) : boolean",
            "kind": 2,
            "detail": "List.add(Object e) : boolean",
            "sortText": "999998971",
            "insertText": "add",
            "insertTextFormat": 2,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 15,
                        "character": 7
                    },
                    "end": {
                        "line": 15,
                        "character": 10
                    }
                },
                "newText": "add(${1:e})"
            },
            "data": {
                "decl_signature": "Ljava.util.List<Ljava.lang.Object;>;",
                "signature": "(Ljava.lang.Object;)Z",
                "name": "add",
                "pid": "1",
                "rid": "30",
                "uri": "file:///Users/fbricon/Dev/souk/standalones/max/src/foo/bar/Demo.java"
            }
        },
        {
            "label": "addAll(int index, Collection<? extends Object> c) : boolean",
            "kind": 2,
            "detail": "List.addAll(int index, Collection<? extends Object> c) : boolean",
            "sortText": "999999035",
            "insertText": "addAll",
            "insertTextFormat": 2,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 15,
                        "character": 7
                    },
                    "end": {
                        "line": 15,
                        "character": 10
                    }
                },
                "newText": "addAll(${1:index}, ${2:c})"
            },
            "data": {
                "decl_signature": "Ljava.util.List<Ljava.lang.Object;>;",
                "signature": "(ILjava.util.Collection<+Ljava.lang.Object;>;)Z",
                "name": "addAll",
                "pid": "2",
                "rid": "30",
                "uri": "file:///Users/fbricon/Dev/souk/standalones/max/src/foo/bar/Demo.java"
            }
        },
        {
            "label": "addAll(Collection<? extends Object> c) : boolean",
            "kind": 2,
            "detail": "List.addAll(Collection<? extends Object> c) : boolean",
            "sortText": "999999035",
            "insertText": "addAll",
            "insertTextFormat": 2,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 15,
                        "character": 7
                    },
                    "end": {
                        "line": 15,
                        "character": 10
                    }
                },
                "newText": "addAll(${1:c})"
            },
            "data": {
                "decl_signature": "Ljava.util.List<Ljava.lang.Object;>;",
                "signature": "(Ljava.util.Collection<+Ljava.lang.Object;>;)Z",
                "name": "addAll",
                "pid": "3",
                "rid": "30",
                "uri": "file:///Users/fbricon/Dev/souk/standalones/max/src/foo/bar/Demo.java"
            }
        }
    ]
}


[Trace - 10:31:04 AM] Sending request 'completionItem/resolve - (769)'.
Params: {
    "label": "add(Object e) : boolean",
    "detail": "List.add(Object e) : boolean",
    "insertTextFormat": 2,
    "textEdit": {
        "newText": "add(${1:e})",
        "range": {
            "start": {
                "line": 15,
                "character": 7
            },
            "end": {
                "line": 15,
                "character": 10
            }
        }
    },
    "kind": 2,
    "sortText": "999998971",
    "data": {
        "decl_signature": "Ljava.util.List<Ljava.lang.Object;>;",
        "signature": "(Ljava.lang.Object;)Z",
        "name": "add",
        "pid": "1",
        "rid": "30",
        "uri": "file:///Users/fbricon/Dev/souk/standalones/max/src/foo/bar/Demo.java"
    }
}


[Trace - 10:31:04 AM] Received response 'completionItem/resolve - (769)' in 8ms.
Result: {
    "label": "add(Object e) : boolean",
    "kind": 2,
    "detail": "List.add(Object e) : boolean",
    "sortText": "999998971",
    "insertTextFormat": 2,
    "textEdit": {
        "range": {
            "start": {
                "line": 15,
                "character": 7
            },
            "end": {
                "line": 15,
                "character": 10
            }
        },
        "newText": "add(${1:e})"
    }
}

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

Successfully merging a pull request may close this issue.

4 participants