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

Critical completion issue for completions on a object inside block #2387

Closed
gayanper opened this issue Jan 2, 2023 · 4 comments · Fixed by #2393
Closed

Critical completion issue for completions on a object inside block #2387

gayanper opened this issue Jan 2, 2023 · 4 comments · Fixed by #2393

Comments

@gayanper
Copy link
Contributor

gayanper commented Jan 2, 2023

package com.example.demo;

import java.util.function.Supplier;

public class MyFilter {

    public void filter() {
        if (true) {
            Response response = new Response();
            response.beforeCommit(() -> {
                return null;
            });
        }
    }

    private static class Response {

        public void beforeCommit(Supplier<Object> supplier) {
        }

    }
}

if you try to invoke completions at response. you will not get any completions. The completions will start work if you take that statement out of if block or remove the lambda block parameter.

@gayanper
Copy link
Contributor Author

gayanper commented Jan 2, 2023

This seems to work in jdt.core master.

@snjeza
Copy link
Contributor

snjeza commented Jan 3, 2023

This is an upstream VS Code issue.
The following code works fine:

response.|beforeCommit(() -> {return null;});
response.|beforeCommit(null);
response.| beforeCommit(() -> { // there is a blank after the cursor
                return null;
            });
response.| beforeCommit( // there is a blank after the cursor
                null);

The following code doesn't work

response.|beforeCommit(() -> {
                return null;
            });
response.|beforeCommit(
                null);

The issue can't be reproduced in jdt.core >= v20221202-2024 (Java LS Pre-Release use it)

@snjeza snjeza self-assigned this Jan 3, 2023
@snjeza snjeza added the upstream label Jan 3, 2023
@gayanper
Copy link
Contributor Author

gayanper commented Jan 7, 2023

@snjeza from your above comment its not a upstream issue if we upgrade to latest milestone or i-build release in the pre-release LS version right ?

@snjeza
Copy link
Contributor

snjeza commented Jan 8, 2023

@gayanper it isn't Eclipse jdt issue. It is a VS Code issue. I will fix it.

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.

3 participants