Constructor is being generated empty
When I use the "Generate constructor" command, it ignores my private variables and it generates and empty constructor.
private _id : string;
public get id() : string {
return this._id;
}
public set id(v : string) {
this._id = v;
}
//This is what it gets generated when I run the command.
constructor() {
}
Is there any way to debug the extension?
Any help to resolve the bug would be appreciated.
Hi joseques,
It may be because you've got a space between the var name and : Try this private _id: string; Then generate again, It's actually working fine for me.
See you
https://github.com/cybertim/vscode-gengetset/blob/4f5eac275a458f1535dd3dd36a6cde3b8f87a462/src/getset.ts#L51
should be
if (currentPos.isAfterOrEqual(classes[i].startPos) && currentPos.isBeforeOrEqual(classes[i].endPos)) {
You can fix it locally by editing the file ~/.vscode/extensions/dskwrk.vscode-generate-getter-setter-0.5.0/out/src/getset.js and reloading the window (or closing and starting vscode again).