This is inspired by vscode-gengetset. I simplify it with only constructor generator and modify it with my purpose. Also I fixed the issue when the extension command can not work for multiple classes in one file. Since that project isn't maintained and out of date, I'm creating this to support my current need.
(without semicolon). I'll update options to support both semicolon and non-semicolon.
- First version: Supporting only Generate Constructor command. With 3 variables or less, the constructor has single line for inputs. With 4 or more, the constructor will have single line for each variable.
Get VSCode and grab the extension from the VSCode Extension Market
- Just place your cursor within a TypeScript class definition in the text editor window
- Open the command palette
ctrl+shift+P
/cmd+shift+P
. - Search for 'Generate Constructor'
or
- Just place your cursor within a TypeScript class definition in the text editor window
- Press
alt+shift+G
for a quick selection pop-up - Select the preferred function from the pop-up menu
or
- Click on the little Eye-Icon in your statusbar
- Select the preferred function from the pop-up menu
The generated method will be placed at the cursors position.
Enjoy!