Why snippet doesn't work with ejs file?


I installed language-ejs package and then added this to snippet:

    'prefix': 'bower'
    'body': '<link rel="import" href="bower_components/$1/$1.html">'

However, when I opened an index.ejs file and hit Alt+Shift+S, the snippet bower doesn’t show up. You guys have any idea about this? I restarted Atom



The snippet will only work if the ejs file has .text.html.js in its grammar scope.

You can check the scope of ejs by opening your index.ejs file and pressing Ctrl+Shift+Alt+P. You’ll get a notification that shows the scope (as well as the other scopes of the word at your cursor):

I don’t know what scope ejs uses, but I’d first verify that .text.html.js is actually correct.

Once you have verified or corrected the scope, the snippet should work. If it still does not work, it could be you are accidentally defining snippets for the same scope multiple times, in which case only the last one will activate. See this topic for more information:



I know It’s been 4 years since this was posted but I wanted to leave my solution here for future reference.
I had the same issue with .ejs files. The scope that worked for me was '.text.ejs'

Here is the full snippet:

   'HTML with Viewport':
     'prefix': 'html'
     'body': '''
     <!DOCTYPE html>
     <html lang="en" dir="ltr">
         <meta charset="utf-8">
         <meta name="viewport" content="width=device-width, initial-scale=1">

Hope it helps someone!