Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snippits? #587

Open
rbnpi opened this issue Jul 23, 2015 · 7 comments

Comments

Projects
None yet
5 participants
@rbnpi
Copy link
Contributor

commented Jul 23, 2015

Will there be docs for snippits added in this release, or is it still under development?
at present
do
ll
fx r
fx b
all work (although two sps files for fx r currently in snippets folder)
and of course you can add your own (although not perhaps for most users)

@samaaron

This comment has been minimized.

Copy link
Owner

commented Jul 23, 2015

I haven't decided whether to add snippets to v2.6 or keep them in development yet :-)

@samaaron

This comment has been minimized.

Copy link
Owner

commented Aug 17, 2015

No docs yet - I'm not officially supporting this implementation at this stage.

However to play with it now (with the caveat that it all may drastically change) you just need to create a file with the contents of your snippet with an .sps extension in a directory somewhere on your machine. You might want to create a snippets directory for your own personal snippets. The name of the file doesn't matter. You then load all the snippets in a given directory with:

load_snippets("/path/to/snippets/dir")

At the top of the file you'll need to put some metadata telling Sonic Pi when to trigger your snippet and where to leave the cursor.

Here's an example of a complete snippet (from here: https://github.com/samaaron/sonic-pi/blob/master/etc/snippets/fx/fx_reverb.sps):

# key: fx r
# point_line: 1
# point_index: 2
# --
with_fx :reverb do

end
  • # key: tells Sonic Pi which letters to look for prior to point (the cursor) when tab is hit.
  • # point_line: tells Sonic Pi which line to place the point on (relative to the snippet). This is 0 indexed
  • # point_index: tells Sonic Pi which position on the line to place the po I int (also 0 indexed). This is also relative to the snippet.

Let me know if you have any further questions. I plan on adding more sophistication to this system once I can figure out how to implement it :-)

@mbutz

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2016

If at some point you decide to offer this as an official feature, it would be very convenient, if the completion functionality knew of the snippets (quite hard to remember all the identifiers once you have a whole collection of snippets).
I guess you were already thinking of that. I also guess that this is not a trivial thing to do, so I completely do understand, that this will be well thought of and takes some time ...
Martin

@samaaron

This comment has been minimized.

Copy link
Owner

commented Apr 30, 2016

I’m definitely going to support snippets in the future. The real question is exactly how. I’m currently experimenting with different approaches and the secret version in Sonic Pi is one of them.

This is a typical development approach for me for Sonic Pi - I let an idea bake over a number of months (even for a year) whilst constantly using/refining and occasionally completely changing it. Eventually I end up with something much more polished and usable than the first implementation I came up with :-)

Sam

On 30 Apr 2016, at 21:42, G. Martin Butz notifications@github.com wrote:

If at some point you decide to offer this as an official feature, it would be very convenient, if the completion functionality knew of the snippets (quite hard to remember all the identifiers once you have a whole collection of snippets).
I guess you were already thinking of that. I also guess that this is not a trivial thing to do, so I completely do understand, that this will be well thought of and takes some time ...
Martin


You are receiving this because you commented.
Reply to this email directly or view it on GitHub

@mbutz

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2016

Yes, I appreciate the results of this approach very much. I also
understand, that you do not want to propagate half baked solutions.

Having said that, if Sonic Pi users somehow discover 'secret functions'
and want to use 'easter eggs' they will have to live with the fact, that
an unofficial feature in the current implementation is only available
until you've finished the official one. No problem at all. Besides - it
might result in valid feedback from people using it in alpha state.

I saw a presentation of Xavier and wondered where he get's the code
from. I thought this is exactly what I need to secure my upcoming
presentation. It's boring to see someone typing lines of code (at least
if you have limeted time to present); also I do not trust yet my Sonic
Pi knowledge to much.

Thanks for your comments on that!

Martin

Am 30.04.2016 um 22:55 schrieb Sam Aaron:

I’m definitely going to support snippets in the future. The real
question is exactly how. I’m currently experimenting with different
approaches and the secret version in Sonic Pi is one of them.

This is a typical development approach for me for Sonic Pi - I let an
idea bake over a number of months (even for a year) whilst constantly
using/refining and occasionally completely changing it. Eventually I
end up with something much more polished and usable than the first
implementation I came up with :-)

Sam

On 30 Apr 2016, at 21:42, G. Martin Butz notifications@github.com
wrote:

If at some point you decide to offer this as an official feature,
it would be very convenient, if the completion functionality knew
of the snippets (quite hard to remember all the identifiers once
you have a whole collection of snippets). I guess you were already
thinking of that. I also guess that this is not a trivial thing to
do, so I completely do understand, that this will be well thought
of and takes some time ... Martin

— You are receiving this because you commented. Reply to this email
directly or view it on GitHub

--- You are receiving this because you commented. Reply to this email
directly or view it on GitHub:
#587 (comment)

| G. Martin Butz, mb@mkblog.org, 0421 98749324, www.mkblog.org |
@hopbit

This comment has been minimized.

Copy link
Contributor

commented May 1, 2016

I love the snippets feature in it's current state, it's very helpful. But I understand that Sam would like to give it a little more love.

@samaaron If You thinking on how snippets would be even better than now then I'd suggest to take a look at Sublime Text Snippets or Intellij IDEA Live Template. I think both systems are very nice. I use them a lot.

Here's a 3 min video that's show how snippets works in Sublime Text: https://www.youtube.com/watch?v=DlE4cupYOys

And here's an article on it: http://sublimetext.info/docs/en/extensibility/snippets.html

@juliancheal

This comment has been minimized.

Copy link
Contributor

commented Feb 7, 2018

I've made a WIP PR, well more Proof of Concept of how built in & user Snippets could work. #1821

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.