Closed lichenhao closed 6 years ago
@lichenhao I just installed this extension and was also bothered by it taking over html files. In my opinion this is a very bad approach. Nunjucks extends the html syntax. So valid html is very likely to be valid nunjucks, not the other way around. Forcing nunjucks over html might result in broken markup.
Especially considering we're losing intellisense, emmet, etc. when working with nunj templates.
Back to your question. You can use the files.associations
setting.
You can add something like this to your user settings:
"files.associations": {
"*.htm": "html",
"*.html": "html"
}
This way, VS Code will treat all .htm
and .html
files as html files instead of nunjucks. You can also set this in your workspace settings, and match for specific folders, etc. using for example:
"files.associations": {
"**/src/templ/*.html": "nunjucks"
}
So that those files are treated as nunjucks templates even though the .html
extension is used.
You can get creative.
More info: https://code.visualstudio.com/docs/languages/overview and https://code.visualstudio.com/docs/languages/identifiers
Yeah~ This works well Thanks for your help.
@fgallardograzio thanks! that was driving me crazy
This is still a working fix - been driving me mad for months! Cheers @fgallardograzio x
The .html file is not .nunjucks template . How can I disabled this ? What should I do?