Snippets for custom file


#1

I’m wanting to use custom snippets for a file that ends in .acm
Here are some snippets I wrote already in snippets.cson, I use ‘source.’: because i’m really not sure what language to use, so I left the bit after source. blank. I’m sorry if I’m not making sense, but I’d really like to be able to use some snippets for this code.

'.source.':
  'Allow Interupt':
    'prefix': 'Allow_Interupt()'
    'body': 'Allow_Interupt()'

'.source.':
  'Asynchronous Timer':
    'prefix': 'Asynchronous_Timer(Frames=)'
    'body': 'Asynchronous_Timer(Frames=)'

'.source.':
  'Script End':
    'prefix': 'End'
    'body': 'Script_End()'

#2

Looking around a bit more, it’s a plaintext file with the extension of .acm. (named Attack11.acm for example)
Would I just use this?

'text.plain':
  'Allow Interupt':
    'prefix': 'Allow_Interupt()'
    'body': 'Allow_Interupt()'

  'Asynchronous Timer':
    'prefix': 'Asynchronous_Timer(Frames=)'
    'body': 'Asynchronous_Timer(Frames=)'

  'Script End':
    'prefix': 'End'
    'body': 'Script_End()'

Again, I’m sorry if it’s a stupid question, but it’s really bothering me.


#3

I’ve found that this works, but it should work for every file now, and I don’t need that.

'*':
  'Allow Interupt':
    'prefix': 'Allow_Interupt()'
    'body': 'Allow_Interupt()'

  'Asynchronous Timer':
    'prefix': 'Asynchronous_Timer(Frames=)'
    'body': 'Asynchronous_Timer(Frames=)'

  'Script End':
    'prefix': 'Script_End()'
    'body': 'Script_End()'

#4

Atom ties snippets to language scopes. A language scope is the scope name that is tied to that one language. So you would have to pick a language scope for your “acm” language, teach Atom how to recognize your “acm” language, and then create snippets using that language scope.


#5

Thank you so much! Worked like a charm!
For anyone who cares… Config.cson

"*":
  core:
    customFileTypes:
      '.text.plain': [
        'acm'
      ]

Snippets.cson

'.text.plain':
  'Allow Interupt':
    'prefix': 'Allow_Interupt()'
    'body': 'Allow_Interupt()'

  'Asynchronous Timer':
    'prefix': 'Asynchronous_Timer(Frames=)'
    'body': 'Asynchronous_Timer(Frames=)'

  'Script End':
    'prefix': 'Script_End()'
    'body': 'Script_End()'