Magnus Lundberg
Magnus Lundberg

Reputation: 793

Customize default getter/setter template in IntelliJ

I have created a custom template for setters in IntelliJ. I can chose that template when I use Alt + Insert and it works great.

However when I try to press Alt + Enter to generate a missing setter it uses the IntelliJ default.

How to make the Alt+Enter completion use my custom template instead of the default?

Upvotes: 2

Views: 1355

Answers (1)

hc_dev
hc_dev

Reputation: 9377

Using Alt + Insert to Generate getters and setters, a dialog opens, where you can customize the default template used by IntelliJ by clicking on the 3 dots button ....

dialog (dark mode)

or

dialog steps

Next the respective dialog will open, for example Generate Setter Dialogue. You can duplicate the default template (named 'IntelliJ Default') and adapt the copy to your needs. For a detailed description of template-variables see Getter/Setter Templates.

The customized template will also be used when pressing Alt + Enter to open intention actions in the context-menu.

See also

Upvotes: 2

Related Questions