I'd like my methods in classes sorted in Python files. I do wonder if PyCharm has such option (I couldn't find one).
Python sorted() Function You can specify ascending or descending order. Strings are sorted alphabetically, and numbers are sorted numerically.
You can configure the IDE to rearrange code elements in modified files automatically when your changes are saved. Press Ctrl+Alt+S to open the IDE settings and select Tools | Actions on Save. Enable the Rearrange code option.
To quickly sort lines alphabetically, select them in the editor and choose Edit | Sort Lines from the main menu. Alternatively, you can run this action using the Find Action command (Cmd/Ctrl+Shift+A).
To sort your file, open the file via solution explorer: Right click the open file. Code Maid menu (likely near the top of the right click menu) Click Reorganize Active Document.
Nowadays, there is code blocks sorter which might help with this feature
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With