vscode-django icon indicating copy to clipboard operation
vscode-django copied to clipboard

Incorrect formatting on Save

Open chirdeeptomar opened this issue 2 years ago • 2 comments

Extension is formatting the template incorrectly breaking the template.

Screenshot 2023-01-18 at 20 44 12

chirdeeptomar avatar Jan 18 '23 20:01 chirdeeptomar

I figured out I have prettier extension installed which was formatting the file. I can disable prettier to format html file but that's no good. I want the file formatted with this extension instead of default html.

I have the following config in settings.json under .vscode

{
    "python.formatting.provider": "black",
    "[html]": {
        "editor.defaultFormatter": "batisteo.vscode-django"
    },
    "emmet.includeLanguages": {
        "django-html": "html"
    },
    "files.associations": {
        "**/*.html": "html",
        "**/templates/**/*.html": "django-html",
        "**/templates/**/*": "django-txt",
        "**/requirements{/**,*}.{txt,in}": "pip-requirements"
    },
}

chirdeeptomar avatar Jan 18 '23 20:01 chirdeeptomar

I'm having the same issue. Fixed by using *.html in .prettierignore thanks to this answer

hichemfantar avatar Feb 05 '23 18:02 hichemfantar