Automatic formatting of Django templates

I switched from PyCharm to VSCode (and think it truly worths it), but the only thing I’m still struggling with is this Django template formatting.

An ugly workaround is to use PyCharm command line formatting tool.
But each formatting action takes 5 seconds, and of course it’s not a standalone tool, you need PyCharm installed locally. I can’t name this a “solution”.

@andrewgodwin I’m questioning myself: would an official VS Code Django plugin be something impossible to develop internally in Django teams?

My thoughts about this:

  • VS Code is becoming a “no-brainer choice” code editing tool for many people. As a personal opinion, I see no point using PyCharm today except for a Django project. But dealing with two IDEs is painful.

  • Even if one disagree about the statement above, I don’t see a Django beginner spending money to buy PyCharm pro Edition (the free edition has no real Django support), especially because VS Code is free. Which means the first experience this beginner will get with Django templates will be … not perfect.

  • Many developers love Django, but they are and more and more used to a top-level tooling experience, especially in JS community. Auto-formatters are getting really mainstream with tools like Prettier. I have the feeling that many developers could decide NOT using Django templates, just because front-end development experience is way better with tools like Vue.js, almost out of the box.

  • Some modern frameworks come with their own official plugin (I’m thinking of TailwindCSS Intellisense) and it’s amazing. It just works. To me, it’s truly more valuable when it’s official. It brings trust, and removes the need of choosing among 10 different plugins that overlaps themselves.

I know it takes huge work, but I’m curious to hear your point of view about the prioritization of such work, compared to classic features.

2 Likes