Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you format a file without the excepted extension in PyCharm?

Tags:

pycharm

Context:

I have data saved to files without extensions. These files map to http urls but are on the filesystem and are used as cache. ie http://server.com/calendar/data would have a corresponding file at /tmp/calendar/data. So it's important that I keep the file names as is.

When I open the file data which is a json file in PyCharm I can't Reformat Code and have it human readable.

Is there a way to format files that are json ad hoc in PyCharm? Is it possible to choose the formatter in PyCharm as opposed to having the extension dictate it?

like image 925
pcauthorn Avatar asked Oct 29 '25 14:10

pcauthorn


1 Answers

You right click on the file, then you click Override File Type and then you choose JSON.

enter image description here

By following the aforementioned steps, the Reformat Code option is activated:

enter image description here

like image 71
Andreas Violaris Avatar answered Oct 31 '25 12:10

Andreas Violaris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!