Home Download Buy Blog Forum Support

Ruby package issues with 'do' snippet

Ruby package issues with 'do' snippet

Postby luislavena on Tue Sep 28, 2010 11:53 am

Hello,

Using Sublime 1.4 had issues with Ruby package when pressing 'do' and then tab for autocomplete.

The output I received was:
Code: Select all
dovariablevariablevariable
end


I expected to see:
Code: Select all
do |variable|
end


Instead.

Took a quick look to the snippet and couldn't figure out the regexp to fix it.

Thank you :)
luislavena
 
Posts: 25
Joined: Fri Jun 04, 2010 7:15 pm

Re: Ruby package issues with 'do' snippet

Postby jps on Wed Sep 29, 2010 7:16 am

The snippet is doing some funky things with named expressions, below is a simpler version that will work properly with Sublime Text's regex engine. Let me know if this works for you, and I'll include it by default.

Code: Select all
<snippet>
    <content><![CDATA[do${1/(^.+$)|^$/(?1: |)/}${1:variable}${1/(^.+$)|^$/(?1:|)/}
   $0
end]]></content>
    <tabTrigger>do</tabTrigger>
    <scope>source.ruby</scope>
    <description>Insert do |variable| … end</description>
</snippet>
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: Ruby package issues with 'do' snippet

Postby luislavena on Thu Sep 30, 2010 12:34 pm

Awesome, thank you.

It did the trick.
luislavena
 
Posts: 25
Joined: Fri Jun 04, 2010 7:15 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 29 guests