magidc / nvim-config

My config for Neovim
73 stars 14 forks source link

How to generate getters/setters #7

Closed gravitational0 closed 4 months ago

gravitational0 commented 4 months ago

my code

package org.example;

public class Department {
    private long id;
    private String name;

}

i want to make like this code

package org.example;

public class Department {
    private long id;
    private String name;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
magidc commented 4 months ago

This feature is already available through the "code actions". Just type space+r+e imaxe

LSP should be attached to the current buffer. In this case, jdtls (java). Make sure you have installed it with Mason (:MasonInstall jdtls)