Skip to content

Bug: Quick fix does not suggest basic imports as a solution #3715

Closed

Description

@Biyakuga

[provide a description of the issue]

Environment

Operating System: Windows11
JDK version: 17
Visual Studio Code version: 1.88
Java extension version: 1.29

Steps To Reproduce
  1. Create a java file and try to create List/Set/Map
  2. Error no import available from quick fix

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

image

Current Result

Like in the image above I have to manually add the import to fix the problem

Expected Result

Quick fix should give me imports as a suggestion

Activity

  1. changed the title [-]Quick fix does not suggest basic imports as a solution[/-] [+]Bug: Quick fix does not suggest basic imports as a solution[/+] on Jul 19, 2024
  2. snjeza commented on Jul 19, 2024

    @snjeza
    Collaborator

    I can't reproduce the issue.
    @Biyakuga Could you show your extensions and settings.json?

  3. Biyakuga commented on Jul 22, 2024

    @Biyakuga
    Author

    I can't reproduce the issue. @Biyakuga Could you show your extensions and settings.json?
    Sure here is my settings.json:
    image

    Here is my extensions list:
    image
    image

  4. anthonyvdotbe commented on Jul 23, 2024

    @anthonyvdotbe

    I'm having the same issue (also with classes outside java.util, like e.g. java.time.format.DateTimeFormatter).
    This is with the pre-release version (v1.33.2024072008) and the following settings:

    "java.autobuild.enabled": false,
    "java.codeGeneration.hashCodeEquals.useJava7Objects": true,
    "java.codeGeneration.toString.codeStyle": "STRING_FORMAT",
    "java.codeGeneration.useBlocks": true,
    "java.completion.favoriteStaticMembers": [
        "java.lang.System.Logger.Level.*",
        "java.nio.charset.StandardCharsets.*",
        "java.util.Spliterator.*",
        "java.util.function.Predicate.*",
        "java.util.stream.Collectors.*"
    ],
    "java.completion.guessMethodArguments": true,
    "java.configuration.updateBuildConfiguration": "automatic",
    "java.format.comments.enabled": false,
    "java.inlayHints.parameterNames.enabled": "none",
    "java.signatureHelp.enabled": true,
  5. fbricon commented on Jul 23, 2024

    @fbricon
    Collaborator

    I've had this issue yesterday. Java: Clean Java Language Server Workspace fixed it for me. There's definitely something fishy here we need to fix.

  6. magicalmuggle commented on Aug 26, 2024

    @magicalmuggle

    I have encountered the same issue. One way to reproduce it, although inconsistently, is by deleting the import statement for the List class, then closing the window and reopening it. After the project loads completely, press Ctrl + .. By repeating this process, the quick fix sometimes fails to suggest the necessary import for the List class.

  7. rgrunber commented on Oct 16, 2024

    @rgrunber
    Member

    I would try the vscode-java pre-release build tomorrow. There's a good chance this has been fixed now.

  8. MartinBernstorff commented on Oct 24, 2024

    @MartinBernstorff

    This was fixed for me by using the pre-release build 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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