You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
Prettier does not understand django templates and treats it as just html and dereby destroying the temlate syntax into something invalid. This is a prettier issue and not prettier-atom issue ofcourse: prettier/prettier#5581
But prettier-atom should be able to tell from the current filetype the editor is using, that even though the file extension is .html, if the active filetype is something different than text.html.basic, it should not feed it through prettier and possibly destroy all the template tags.
Even though I've changed the filetype to text.html.django prettier-atom still uses prettier to destroy the template code.
The only way to edit django templates is to exclude *.html completely from being formatted as you can see from my prettier debug output below. But that completely disables formatting of html files even though I might want it for non-django html files.
We used to have the parser be inferred by prettier-atom based on the syntax scope exactly as you say. As the number of supported parsers grew, it became harder to maintain as we constantly had to keep updating the mappings of Atom-scope to Prettier-parser.
Then Prettier came out with their "plugins" feature which made it impossible for us to know which parsers your version of Prettier even supported. At this time, Prettier came out with the getFileInfo API which takes a file path as an argument and returns the inferred prettier options (including the parser).
So we switched the entire prettier-atom implementation to rely on just delegating all of the work of inferring the parser and the other options to Prettier itself.
Therefore, I think at this point we probably need to stick to that approach or else we go back to the old problem of having to manually keep the parsers up to date and dropping support for any plugins.
In your specific case, I would use my .prettierrc file to set overrides for those specific HTML files (include the folder they reside in in the glob to only hit those specific ones) and force the parser to be python (or whatever the parser you want to use is).
Prettier does not understand django templates and treats it as just html and dereby destroying the temlate syntax into something invalid. This is a prettier issue and not prettier-atom issue ofcourse: prettier/prettier#5581
But prettier-atom should be able to tell from the current filetype the editor is using, that even though the file extension is
.html
, if the active filetype is something different thantext.html.basic
, it should not feed it through prettier and possibly destroy all the template tags.Even though I've changed the filetype to
text.html.django
prettier-atom still uses prettier to destroy the template code.The only way to edit django templates is to exclude
*.html
completely from being formatted as you can see from my prettier debug output below. But that completely disables formatting of html files even though I might want it for non-django html files.Prettier: Debug output:
The text was updated successfully, but these errors were encountered: