Search code examples
packageatom-editorcode-snippets

Editing a snippet in a package in Atom


In Atom, if a package contains snippets, how do you edit them or delete/deactivate some whilst keeping the rest?

I know I can disable the snippets and copy them into Atom->File->Snippets. However, I think that these snippets would exist for all languages whereas packages like languages-html and languages-latex only activate snippets when their respective language is being used. Is there another way?


Solution

  • Snippets defined in snippets.cson take precedence over all snippets provided by packages, because they are loaded later. You can copy & paste the snippets you want to edit to that file and make your edits. Snippets will be limited to the language grammar you specify in the top-level property.

    Example

    '.source.js':
      'console.log':
        'prefix': 'log'
        'body': 'Unexpectedly, this does not expand to console.log'
    

    This will override the default snippet, which expands log to console.log