redhat-developer / redhat-developer/vscode-java

"No suggestions" for autocompletion inside a lambda

Open
#1,265 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

content-assist enhancement upstream
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

Sometimes autocompletion is unable to provide suggestions inside a lambda

Environment
  • Operating System: Windows 10
  • JDK version: JDK 13
  • Visual Studio Code version: VS Code 1.42.0
  • Java extension version: 0.55.1
Steps To Reproduce

Copy-paste the code below in a Java file & try autocompletion. Note that autocompletion does work on the line outside the lambda.

import java.util.Map;

class Test {

    static class Employee {

        final String name;

        Employee(String name) {
            this.name = name;
        }

        String name() {
            return name;
        }

    }

    public static void main(String... args) {
        var totals = Map.of(new Employee("John"), 0);
        Employee e = new Employee("Jane");
        //totals.put(e., 0);
        List.of("foo").forEach(item -> {
            totals.put(e., 0);
        });
    }

}
Current Result

image

Expected Result

Autocompletion provides suggestions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the Java snippet and the listed Windows, JDK, VS Code, and Java extension versions to reproduce the missing suggestions inside the lambda, then compare with completion on the commented line outside it. Done means autocompletion provides suggestions for e. inside the lambda; the issue names no source files or tests, so the completion entry point must be located first.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.