Hey João,
Thanks you for taking the time to read my comments. I inlined a few new ones below.
On Dec 19, 2011, at 8:58 PM, João Távora wrote:
Nice video, but what exactly is the feature you are requesting?
Common prefixes have a common short key (like t.) to allow user to choose from related snippets. An option to .yas-setup.el. Currently I'm using emacs macros to post process the tmbundle for rails snippets from drnic. For example:
The snippets not only have the # key: <originally defined key, mostly unique for each snippet> But will also have the "# key val." So that a user looking for model validation snippets has a good chance of finding exactly what he wants by typing val.[tab]
Note the menu yasnippets > rails-mode take up about 4 screens at 1152 x 720 on my system. Even the 20 or so val.[tab] completions
is a bit much but I think more tractable.
The snippets:
validates.yasnippet
validates_acceptance_of if.yasnippet
validates_acceptance_of.yasnippet
validates_associated (va).yasnippet
validates_associated if (vaif).yasnippet
validates_confirmation_of (vc).yasnippet
validates_confirmation_of if (vcif).yasnippet
validates_exclusion_of (ve).yasnippet
validates_exclusion_of if (veif).yasnippet
validates_format_of if.yasnippet
validates_format_of.yasnippet
validates_inclusion_of if.yasnippet
validates_inclusion_of.yasnippet
validates_length_of (vl).yasnippet
validates_length_of if.yasnippet
validates_numericality_of if.yasnippet
validates_numericality_of.yasnippet
validates_presence_of (vp).yasnippet
validates_presence_of if (vpif) 2.yasnippet
validates_uniqueness_of (vu).yasnippet
validates_uniqueness_of if (vuif).yasnippet
I experimented with grouping instead of using the expansion but the expansion seems much more useful.
textmate_import.rb imports directly from textmate bundles, so if this
snippet layout isn't available in a particular bundle, it won't be
imported, although you might convince the author of the textmate
bundle to support that...
Nice idea. But if I can convince you to make bundle conversion friendlier then all imported bundles will benefit, not just the rails one from drnic.
In other words the point is that I do not want to hand-tweak the
snippets directly,
Nor do I but I am currently doing what could much more easily be done by the converter. How about an option to .yas-setup.el, to provide this automated beginner grouping snippet addition for tmbundles?
only tweak the textmate-import.rb tool and the
.yas-setup.el files to provide a smoother importation.
A smooth import is great. An augmented import is nice too, no?
This behaviour exists in the "t." snippets of the textmate rails
bundle, I guess the author only thought it useful there.
Or drnic was concerned with his own use of the snippets he created. Generously, he made them available to the public. But he left the boring work of making them more friendly for beginners and intermediates as an exercise for the user. So I've been adding my hand tweaks to the generated code. I do not know the tm macro syntax, or I would have forked his tmbundle.
Tangent: Thinking out loud: It would be hard to become very familiar with emacs without the describe-function, apropos-command and describe-variable functions. I wonder if the snippet system could be tied into those as well?
A small change to the importer can greatly increase usability. I guess automatically adding groupings could be done with a post import processing tool. But, you probably have everything already at your finger tips.
You can also
use the menu to check out which validations are available.
See long list in menu, in the comment above.
Thanks,
João Távora
On Mon, Dec 19, 2011 at 3:24 PM, Charles M Magid <
cmmagid <at> gmail.com> wrote:
Yasnippet is cool.
I thought of a feature which might make the resulting rails snippets
more useful.
I started converting the snippets by hand but realized this might be
useful to a greater audience.
Please see video demo for explanation of my request:
http://www.youtube.com/watch?v=blB4AkFTVs8
Best,
::Charles
--
You received this message because you are subscribed to the Google Groups "smart-snippet and YASnippet" group.
To post to this group, send email to smart-snippet-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To unsubscribe from this group, send email to smart-snippet+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/smart-snippet?hl=en.
--
João Távora
--
You received this message because you are subscribed to the Google Groups "smart-snippet and YASnippet" group.
To post to this group, send email to
smart-snippet-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To unsubscribe from this group, send email to
smart-snippet+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit this group at
http://groups.google.com/group/smart-snippet?hl=en.
--
You received this message because you are subscribed to the Google Groups "smart-snippet and YASnippet" group.
To post to this group, send email to smart-snippet-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to smart-snippet+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/smart-snippet?hl=en.