Search code examples
atom-editorcode-snippets

How can I modify Atom HTML auto complete to change what <p> completes?


I am having trouble changing the autocomplete for <p> in Atom. I want to change the autocomplete from <p></p> to <p> For my snippets.cson I have:

'.text.html.paragraph':
  'Paragraph':
    'prefix': 'p'
    'body': '<p>'

However if I type p it still autocompletes using the default <p></p>, what am I doing wrong here?


Solution

  • Your snippet is using an invalid scope .text.html.paragraph. This would work, if you had a language installed that is providing that scope. But since the paragraph is part of HTML, it makes little sense to treat it separately.

    So, in order to get your snippet working, change the scope to .text.html or .text.html.basic. The difference is that the former would work for Markdown or languages inheriting from HTML, e.g. language-html-angular. The latter will limit your snippet strictly to HTML.