Reputation: 311
So I'm trying to make a project using Spring Boot and I had been able to use the "Generate Setters/Getters" button before on this same file but for some reason that option is no longer available in the dropdown. Could someone provide an explanation for why this is and what may have happened to this option?
Upvotes: 25
Views: 46571
Reputation: 165
Try this: Right click >> Source Action
Same step for construction generation also
Upvotes: 1
Reputation: 695
You might be missing the add-on "Java Code Generators" which you can download from the marketplace. I installed this and I was able to generate getters and setters.
The solution posted by Madhu works. I added the image below for anyone to follow along.
Upvotes: 39
Reputation: 411
Try this: Right click >> Source Action
See here for a list of actions.
Upvotes: 41
Reputation: 1
If you have "Java extension pack" from Microsoft installed. Do this:
-Right Click on the workbench.
-Click on Source Actions: VSCODE view
-Click on "Generate Getter and Setter": VSCODE view
-Select the attributes to which you want to generate the getters and setters
Upvotes: 0
Reputation: 311
Ah, I figured it out, apparently import lombok.Data
handles all getters, setters, and other stuff in the background. This had the unexpected result of getting rid of the generate getters/setters option in the dropdown menu. I got rid of this import in the code and the menu option was back.
Upvotes: 3