New Grammar seems not recognized


I have created a very basic grammar scope named ‘source.django’ for html files.
And added a snippet named block for it.

'scopeName': 'source.django'
'name': 'Django'
'fileTypes': [
'patterns': [
    'include': 'text.html.basic'


    'prefix': 'block'
    'body': '{% block $1 %}$2{% endblock $1 %}'

The block snipped does not show up in html files.
however, when I change the snippet scope name to ‘.text.html.basic’, it showup and work.
The grammar is available in github:


When you open an HTML file, which grammar is applied to it? This can be checked using Editor: Log cursor scope in the command palette.

I suspect the normal HTML grammar is being applied, as it has the firstLineMatch property which will give it a score boost in the automatic grammar selector.

To get your grammar applied, you may need to add a first line match rule, or disable language-html (which would make the rest of your grammar break though).

Having said that, if your language is predominantly HTML based, you may want to be using injectionSelector instead. For more on this, yo can look at the following post