Define word separators for snippets


#1

I was hoping to modify the default snippet trigger-prefixes, or whatever you call the equivalent to Sublime Text’s word_separators. Basically, I’m looking for a way to define different characters that trigger a snippet. I have created a package of NSIS snippets and I would love to trigger snippets using the exclamation point and the dollar sign. That way it would be easier to distinguish between the snippets for !if, ${If} and other commands starting with the prefix If, rather than relying on lower/upper-case.

I was hoping nonWordCharacters in config.json would do that, but it does not. Is there another way to configure trigger prefixes?


#2

I don’t believe non-word-characters enters into how snippets behave at all. For example, I put the following into my snippets.cson under the .source.gfm section:

Test:
  prefix: '! !'
  body: 'BLAH'

When I opened the Atom README.md and typed ! Space ! Tab, BLAH was inserted as expected.


#3

Well, that works also for me, but that’s not what I looking for. Maybe “snippets” is the wrong terminology, I’m looking for those commands completions that can be previewed before tab-completing them.

Consider this ”snippet”:

  '!addincludedir':
    'prefix': '!addincludedir'
    'body': '!addincludedir "${1:directory}"'

It completes when I type the full prefix, but I never get to see a preview. Knowing 500 abbreviations for 500 commands doesn’t make much sense – that’s why I appreciate the preview pane.

So, I wonder why I can’t see a preview for prefixes that contain (or at least start with) a non alphanumeric-character.