Home Download Buy Blog Forum Support

Auto-complete issues when snippet starts with $

Auto-complete issues when snippet starts with $

Postby Iristyle on Fri Sep 21, 2012 3:07 pm

There appear to be a few issues with snippets or completions that start with the $ character. I'm not sure if this has to do with it being the start line regex character or what?

- Just typing the $ will not open the completions menu automatically like it does for other alphanumeric characters. You must manually hit Ctrl+Space.

- If I start to type additional characters, the completion menu will open. So for instance, lets say I have a completion like $resource ... I type $re and the menu pops open, highlighting $resource. When I press tab, the text that I've entered in the editor is eaten.

- Similarly if I type $, then hit Ctrl+Space and scroll through the menu with the keyboard, select something, then hit tab.. the text is eaten.


This is causing a bit of static for an AngularJS package that I put together, because many of the global variables start with $. See the completions here as an example - https://github.com/EastPoint/Sublime-An ... ompletions


https://github.com/EastPoint/Sublime-An ... ompletions

There are a few other issues listed in the README there -- but I figured I'd try and draw attention to the issue that's causing the most difficulty at the moment.


Thanks!
Iristyle
 
Posts: 3
Joined: Fri Sep 21, 2012 2:26 pm

Re: Auto-complete issues when snippet starts with $

Postby grumpyOldRussian on Fri Sep 21, 2012 3:41 pm

+1
grumpyOldRussian
 
Posts: 6
Joined: Thu Sep 20, 2012 12:21 pm

Re: Auto-complete issues when snippet starts with $

Postby agibsonsw on Fri Sep 21, 2012 5:11 pm

If you edit the default preferences you can remove $ from this setting:

Code: Select all
// Characters that are considered to separate words
    "word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?",


Although it is generally preferable to copy this setting to your own user-preferences file, and edit it there.
"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: Auto-complete issues when snippet starts with $

Postby Iristyle on Fri Sep 21, 2012 6:45 pm

Thanks for the suggestion, but that doesn't work.
Iristyle
 
Posts: 3
Joined: Fri Sep 21, 2012 2:26 pm

Re: Auto-complete issues when snippet starts with $

Postby grumpyOldRussian on Fri Sep 21, 2012 11:08 pm

Indeed, it doesn't
grumpyOldRussian
 
Posts: 6
Joined: Thu Sep 20, 2012 12:21 pm

Re: Auto-complete issues when snippet starts with $

Postby agibsonsw on Fri Sep 21, 2012 11:33 pm

grumpyOldRussian wrote:Indeed, it doesn't

The dollar signs in those completions files need to be \escaped as well. Replace

"$anchorScroll",

with

"\$anchorScroll", etc.

You could do a global replace of $ to \$. But, this said, I haven't tried it yet. It'll only take you a minute to find out though :D
"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: Auto-complete issues when snippet starts with $

Postby grumpyOldRussian on Fri Sep 21, 2012 11:34 pm

it is escaped in all of the snippets. It's not the case here. Thank you though
grumpyOldRussian
 
Posts: 6
Joined: Thu Sep 20, 2012 12:21 pm

Re: Auto-complete issues when snippet starts with $

Postby agibsonsw on Sat Sep 22, 2012 12:25 am

grumpyOldRussian wrote:it is escaped in all of the snippets. It's not the case here. Thank you though


In snippets (rather than completions-files) dollar-signs need to be double-escaped \\ - but I should mention/apologise that I haven't proven my solution (yet :) ).
"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: Auto-complete issues when snippet starts with $

Postby agibsonsw on Sat Sep 22, 2012 2:24 am

I was forgetting that you may also need to adapt the following setting in conjunction with my previous advice:

Code: Select all
// Additional situations to trigger auto complete
    "auto_complete_triggers": [ {"selector": "text.html", "characters": "<"} ],
"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: Auto-complete issues when snippet starts with $

Postby grumpyOldRussian on Sat Sep 22, 2012 11:37 am

agibsonsw wrote:I was forgetting that you may also need to adapt the following setting in conjunction with my previous advice:


can you please elaborate, because escaping it with "\\" doesn't change anything.
grumpyOldRussian
 
Posts: 6
Joined: Thu Sep 20, 2012 12:21 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 9 guests