Please, consider adding option for inserting a snipets like product vbeTwister4vba does.
@kostas505 thanks for the suggestion! As we are discussing the pros and cons of implementing this feature, a number of questions arise:
We're finding there are several cons and little pros to a snippets feature, seeing how easily it can be abused, notably to enable poor coding habits, including copy/paste-coding and cargo-cult error handling, to name a few common coding practices that work against what Rubberduck is promoting.
We could all be wrong and this might be a killer feature, so we need help understanding what makes snippets a useful feature. I for one, have never used them, be it in VB6, VBA, or C#. I do extensively use automatic block/scope completion in Visual Studio though - is that what you had in mind?
I have used this feature in MZTools and found it useful. I can think of one snippet that would be one I might set up:
‘@Folder(“Models”)
Private Type TModel
Parent As IObjectReference
End Type
Private this as TModel
Private Sub Class_Initialize()
Set this.Parent = New IObjectReference
End Sub
Private Sub Class_Terminate()
Set this.Parent = Nothing
End Sub
Public Property Get Parent() As SpecificObject’ change declaration to appropriate object
Set Parent = this.Parent.object
End Property
Public Property Let Parent(ByVal object As SpecificObject’) ’ change declaration to appropriate object
Set this.Parent = ObjectReference.Create(object)
End Property
@SmileyFtW, that's actually a candidate for a template (cf #4549 ).
@SmileyFtW thanks! as @bclothier noted, this does reinforce the impression that class/module templates are a better idea though... what do you typically use MZ-Tools snippets for?
Based on the description of snippets on the vbeTwister4vba website here, the feature seems to be more like customizable auto-completion.
@comintern aaaah! well, that's already on the roadmap then, albeit not exactly like that; looks like a combination of what we'll have as block completion and "autocorrect".
@kostas505 I'll be closing this issue, since this functionality is already on the roadmap. Thanks for the suggestion!
Basically, what i have in mind is how to reduce time in writing the same lines of code over and over again. For example: shortcut key combination for inserting skeleton for subs or functions with basic error handling code.
Anyway, thank you for prompt answer and for great work done so far.
@SmileyFtW thanks! as @bclothier noted, this does reinforce the impression that class/module templates are a better idea though... what do you typically use MZ-Tools snippets for?
Before RD I used MZTools to hold all my bad habits... I have moved away from MZT in favor of RD. Henceforth, I will look into module templates to hold my newly acquired better (RD) habits...
Most helpful comment
@SmileyFtW, that's actually a candidate for a template (cf #4549 ).