'vs code did not recognize lombok
Hello guys I have an issue with my editor vscode. Recently we decided to use Lombok, but the problem that vscode did not recognize getters and setters generated by Lombok I did install the Lombok extension, but what I don't understand when I run the app it works perfectly.
Solution 1:[1]
Assumed you're using the extension Lombok Annotations Support for VS Code, from its official page:
Lombok added as a dependency in your Java Project (Make sure you're using the latest version to avoid issues!) Add with Maven or Add with Gradle
If you're coding in Maven project, add the lombok dependency in pom.xml:
If you're coding in no build tools project, download lombok.jar then add it to referenced libraries:
Solution 2:[2]
Because the compiler and the editor handle Lombok in different ways. The compiler takes Lombok dependency definition(in maven, gradle, etc..) and generates code(getters, setters, constructors) in final bytecode according to usages of Lombok annotations and compile program works perfectly(check the compiled code in a text editor.).
But the editor can not know things after the compilation like generated codes(AOP) and etc...
An editor needs the plugin and a valid configuration. It seems in version 1.0.1 of VS Code Lombok extension autocomplete works perfectly but listing errors and warnings need some fixes.
Try this fix but don't forget VS Code Lombok extension project has not been maintained for 16 months, try to use older Java versions.
Solution 3:[3]
Mine solved in an unexpect way,
The item java.jdt.ls.vmargs in my global setting.json is overwritten in the project-level setting.json, which is located in ${project.dir}/.vscode. It recovers when I delete project-level setting item.
I might accept some of vscode's suggestions popped up in the bottom right corner
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Molly Wang-MSFT |
| Solution 2 | raxetul |
| Solution 3 | lin van |


