Home Download Buy Blog Forum Support

Replacing a snippet

Replacing a snippet

Postby MSch on Fri Feb 17, 2012 6:58 pm

Hi,

I'd like to replace the default JavaScript snippet function.sublime-snippet.

Is this possible without touching the file in the JavaScript package? E.g. can I somehow add a file to my User package that overwrites the JavaScript snippet? Just copying function.sublime-snippet to my User package and changing it did not work.

Thanks,
Martin
MSch
 
Posts: 15
Joined: Fri Jan 13, 2012 11:46 pm

Re: Replacing a snippet

Postby jps on Sat Feb 18, 2012 12:57 pm

It's not possible, the only option is to edit the original snippet.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Replacing a snippet

Postby phillip.koebbe on Wed Apr 18, 2012 12:31 pm

jps wrote:It's not possible, the only option is to edit the original snippet.


I've just encountered this situation myself. I expected a snippet using the same tab trigger for the same scope to replace one defined earlier, but that is not the case. Both snippets showed up and if the description is the same, there is no way to tell them apart. It does appear that they are listed in the order they are created, so a later one will be lower than an earlier one.

I can see why just blindly replacing snippets on tab trigger would not be a good idea, but what are the ramifications of replacing based on tab trigger *and* scope? Is it reasonable to have multiple snippets for the same scope using the same tab trigger? Maybe an option (defaulted off) in the settings to allow override/replacing? I'm getting more and more leary of editing/changing anything that isn't mine, so I'd rather not go into packages and start editing things.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Replacing a snippet

Postby agibsonsw on Wed Apr 18, 2012 1:08 pm

I believe the order of the snippets changes with usage, but it's not something that can be relied upon.

I just copied/movied all the snippets I didn't want outside of the Packages folder. They would probably be re-instated on a future build, or I could just move them back if I wanted to.

Alternatively, why not give your snippet-version a slightly different trigger?
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Replacing a snippet

Postby phillip.koebbe on Thu Apr 19, 2012 11:21 am

agibsonsw wrote:I believe the order of the snippets changes with usage, but it's not something that can be relied upon.


Hm. Hadn't thought of that. That very well may be.

agibsonsw wrote:I just copied/movied all the snippets I didn't want outside of the Packages folder. They would probably be re-instated on a future build, or I could just move them back if I wanted to.


I considered something to this effect, but I loathe getting into a process that requires me to check/move/update things after updates, especially considering that packages installed via Package Manager update silently. When things suddenly stop working the way I expect them to, I get a little frustrated.

agibsonsw wrote:Alternatively, why not give your snippet-version a slightly different trigger?


Muscle memory :) This is actually what I wound up doing. Old dogs can be taught new tricks, it just takes longer and they oftentimes don't ever get them down just right.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 32 guests