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

Broken import autocompletion #591

Closed
fbricon opened this issue Mar 19, 2018 · 5 comments
Closed

Broken import autocompletion #591

fbricon opened this issue Mar 19, 2018 · 5 comments

Comments

@fbricon
Copy link
Contributor

fbricon commented Mar 19, 2018

Given (as a saved file):

package foo;

class Test{
}

typing import java.ut + tab to select the {} java.util completion, as in:

package foo;

import java.ut| //type the whole line without interruption

class Test {
}

leads to a broken completion:

package foo;

java.util.*;class Test {
}

Logged messages:

[Trace - 09:36:48] Sending request 'completionItem/resolve - (794)'.
Params: {
    "label": "java.util",
    "insertTextFormat": 1,
    "kind": 9,
    "sortText": "999999215",
    "data": {
        "pid": "10",
        "rid": "77",
        "uri": "file:/Users/fbricon/Dev/demos/spring-petclinic/src/main/java/foo/Test.java"
    }
}


[Trace - 09:36:48] Received response 'completionItem/resolve - (794)' in 4ms.
Result: {
    "label": "java.util",
    "kind": 9,
    "sortText": "999999215",
    "insertTextFormat": 2,
    "textEdit": {
        "range": {
            "start": {
                "line": 2,
                "character": 7
            },
            "end": {
                "line": 2,
                "character": 12
            }
        },
        "newText": "java.util.*;"
    },
    "additionalTextEdits": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 12
                },
                "end": {
                    "line": 5,
                    "character": 0
                }
            },
            "newText": "\n\n"
        }
    ]
}


[Trace - 09:36:48] Sending request 'textDocument/codeAction - (795)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/fbricon/Dev/demos/spring-petclinic/src/main/java/foo/Test.java"
    },
    "range": {
        "start": {
            "line": 2,
            "character": 14
        },
        "end": {
            "line": 2,
            "character": 14
        }
    },
    "context": {
        "diagnostics": []
    }
}


[Trace - 09:36:48] Sending notification 'textDocument/didChange'.
Params: {
    "textDocument": {
        "uri": "file:///Users/fbricon/Dev/demos/spring-petclinic/src/main/java/foo/Test.java",
        "version": 19
    },
    "contentChanges": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 12
                },
                "end": {
                    "line": 5,
                    "character": 0
                }
            },
            "rangeLength": 19,
            "text": "\n\n"
        }
    ]
}
@fbricon
Copy link
Contributor Author

fbricon commented Mar 19, 2018

Completion works fine if the compilation unit is already dirty (i.e not after opening or saving the file)

@rgrunber
Copy link
Contributor

Does it make sense to revert #566 in the event that this basically introduced it ?

@fbricon
Copy link
Contributor Author

fbricon commented Mar 19, 2018

No, the problem predates your patch.

@snjeza
Copy link
Contributor

snjeza commented Mar 20, 2018

@fbricon Can you reproduce the issue when starting the server with -Djava.lsp.joinOnCompletion=true?
See #512 (comment)

@fbricon fbricon added this to the End November 2018 milestone Nov 28, 2018
@fbricon
Copy link
Contributor Author

fbricon commented Nov 28, 2018

Can't reproduce anymore. Closing.

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