Skip to content

When using .var (Creates a new variable) to create variables for expressions containing abbreviated lambda expressions, variables are positioned in strange positions. #3541

@xftxyz2001

Description

@xftxyz2001

[provide a description of the issue]
When using .var (Creates a new variable) to create variables for expressions containing abbreviated lambda expressions, variables are positioned in strange positions.

Environment
  • Operating System: Windows11
  • JDK version: 21.0.2
  • Visual Studio Code version: 1.87.2
  • Java extension version: 1.28.1
Steps To Reproduce

For example, the following code:

public class TestCreatesANewVariable {

    public static void main(String[] args) {
        IntStream.range(0, 10).map(i -> i + 1).toArray().var
    }
}

[Please attach a sample project reproducing the error]
Please attach logs

Current Result

Generates the following code:

public class TestCreatesANewVariable {

    public static void main(StringString[] args = args) {
            IntStream.range(0, 10).map(i -> i + 1).toArray();
    }
}
Expected Result
public class TestCreatesANewVariable {

    public static void main(String[] args) {
        int[] array = IntStream.range(0, 10).map(i -> i + 1).toArray();
    }
}
Additional Informations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions