Why snippet doesn't work with ejs file?


#1

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

'.text.html.js':
  'bower':
    '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


#2

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: