brpaz / vscode-file-templates-ext

Visual Studio code extenstion that allows to quickly create new files based on defined templates.
45 stars 21 forks source link

Feature Request: 'Insert Template into current file' command #20

Open DanStevens opened 7 years ago

DanStevens commented 7 years ago

Can I make a suggestion of a new command called 'Insert Template into current file' or something equivalent. It should do what it says: insert the contents of a template into the current file at the current cursor position.

My thinking is this could be an alternative to using the User Snippets feature of VSCode, in particular multi-line snippets, which are cumbersome to define.

kcolton commented 6 years ago

Hmm, there is definitely overlap with snippets. The clunkyness of multiline snippets + being used to JetBrains ecosystem (WebStorm, PyCharm, etc) where there is a concept of

"File / Code Templates" which is what this plugin currently fills

"Live Templates" Which are not quite as bad, but still pretty cumbersome for multiline and you quickly get the idea it's not meant for large blocks.

I think the lesser of 2 evils is keeping the distinctions clear and not having this feature. So keeping it distinct like JetBrains does (although their naming could perhaps use some improvement).

An alternative idea is a plugin that makes defining snippets less cumbersome and easier to browse. That I could get behind.


Edit: Found some extensions for creating a snippet from selection: https://github.com/nikitaKunevich/vscode-snippet-creator https://github.com/tariky/easy-snippet-maker

I also love this one, a snippet for creating snippets. https://github.com/wilsonmontalvo/vsc-meta-snippet


Wonder if other people just keep a folder of commonly used templates (VS Code workplaces make this nice) or if they are not sick of typing "current html 5 base template" or "django manage command with arguments" or "html progressive web app template". I know I sure as hell am which is why I need this plugin 😝

Wonder if the unfortunately pricey Kite has any ability to insert 🤔