Support for Code Snippets
Although the JADE IDE does allow a developer to bind code to an accelerator key, the number of bindings is limited and bound accelerator keys are not easily discoverable.
Support for the creation of static and expansion code snippets which could be accessed via an identifier in the JADE IDE editor autocomplete; would make it far easier to reuse useful code.
Along with static code snippets, it would be useful to support expansion snippets which on insertion would require the developer to replace tags with additional details.
Including the ability to export and import snippets would allow developers to share useful code amongst themselves.
Jokingly; a multiple clipboard toolbar may be seen as encouraging copy/paste coding :)
The automatic insertion/completion of code fragments is a powerful and useful tool that helps speed up the act of writing code. The art of the developer will always be knowing what code to write, the act of writing code should ideally be as frictionless as possible and code snippets are a useful means to that end (you can even get a snippet manager for Vim).
The current statement completion feature in JADE acts in the opposite manner, compare the Ctrl+s (Inserts the remainder of the syntax) output for the "foreach" operation to the "foreach" snippet in Visual Studio and you will see what I mean (you have to delete more than you add).
The best example of code snippets/templates I can point you at is the approach used by the CodeRush extension tool, which focuses very heavily on the expansion style of snippet https://community.devexpress.com/blogs/rorybecker/archive/2010/09/14/coderush-templates-101.aspx something similar in the IDE would greatly improve the speed and experience of writing JADE code (especially if it was user editable).
e.g "ifn" could be expanded to ...
if = null then
Where the string is selected for overwriting; this would reduce the time required in JADE to write a null guard to a second or two; these savings build and throughout a day can result in a noticeable time-saving.
Finally to keep the discussion balanced; Why code snippets promote bad design https://whathecode.wordpress.com/2010/11/03/why-code-snippets-promote-bad-design/
Software Medical Infomatics Limited 28/09/2017 1:52:10 PM
Visual Studio Code has good support for code snippets. Basically the user can define their own snippets with a special syntax for places that get highlighted for replacement by the developer.
ReSharper takes things a step further by allowing selection of a macro which does something intelligent to the replacement bit.
But implementing what VS Code has would be fantastic.
Paul Daigneault 27/09/2017 11:17:25 PM
I've updated the idea description as the comments window does not seem to correctly format paragraphs. I hope this helps explain why a code snippet feature in JADE is a worthy addition.
Ty Baen-Price 26/09/2017 12:40:49 PM
Can you please provide some examples? I am interested in helping developers write clean, maintainable code, and this seems like promoting copy/paste coding.