Use value of $1 in snippet


#1

Hey,

the snippet-section in the docs is a little sparing on details.

How can I get this to work?

rgb(${0:255},${1:$0},${2:$0})${3:;}

Basically by default it should show

rgb(255,255,255);

If I change the first value it changes all three, afterwards I can go to the next stop and change the individual values.
This works fine like this in Textmate, but how will it work in Atom?


#2

By looking at the specs it seems there’s no case like that.
I’ll try to look if it can be implemented easily.


#3

Ok, two good news: It feasible already and it’s super easy:

rgb(${1:255}, ${1:${2:255}}, ${1:${3:255}})

For the details, I just tried the following snippet, based on the nested tabstop example in the specs:

'.source.sass, .source.less, .source.stylus, .source.css'
  'rgb':
    'prefix': 'rgb'
    'body': 'rgb(${1:255}, ${1:${2:255}}, ${1:${3:255}})'

#4

Perfect, this is exactly what I need, thanks.

This should be added to the docs .