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

Second argument is replaced upon completing the first argument in a method call #462

Closed
michelkaporin opened this issue Mar 12, 2018 · 5 comments

Comments

@michelkaporin
Copy link

Moved from microsoft/vscode-java-pack#12:

  • VSCode Version: Latest Insiders
  • OS Version: Mac OS

Steps to Reproduce:

  1. Insert cursor before the first argument (that accesses some property) to the method.
  2. Start typing new argument that also accesses property.
  3. On suggestion appearance, press Tab to enter suggestion value
    It replaces the old first argument instance with the property from the new argument.

vscode

Sample code:

public class Test {
    public int testInt;

    public boolean method(int x, int y, int z) {
        return true;
    }
}

public class Main {
    public static void main(String[] args) {
        Test t = new Test();
        t.method(t.testInt, t.testInt);
    }
}
@snjeza snjeza self-assigned this Mar 12, 2018
@gorkem gorkem added the bug label Mar 12, 2018
@gorkem
Copy link
Contributor

gorkem commented Mar 12, 2018

@snjeza If it helps I can easily repro this.

@snjeza
Copy link
Contributor

snjeza commented Mar 12, 2018

@gorkem Thanks. I have reproduced it. It isn't reproducible in Eclipse.

@SummerSun
Copy link
Contributor

Did repro it in Mac OS with VSCode Latest Insiders. But in Windows 10, the issue is a little different.

Repro steps are the same.

java_intellisense

@SummerSun
Copy link
Contributor

Tried with vscode 1.21.0 with windows 10, easily repro this issue.

java_intellisense

Attach the request from client, hope it helps.

[Trace - 3:41:00 PM] Sending notification 'textDocument/didChange'.
Params: {
    "textDocument": {
        "uri": "file:///d%3A/java-debug/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/Breakpoint.java",
        "version": 22
    },
    "contentChanges": [
        {
            "range": {
                "start": {
                    "line": 109,
                    "character": 35
                },
                "end": {
                    "line": 109,
                    "character": 45
                }
            },
            "rangeLength": 10,
            "text": "className()"
        }
    ]
}

@fbricon
Copy link
Collaborator

fbricon commented Apr 10, 2018

the fix introduces a new preference : java.completion.overwrite (boolean). The default (current) behaviour has the value set to true. @michelkaporin you'll be able to change it to false to get what you want.

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

5 participants