osimek1 / intellij-code-blocks-sorter

MIT License
4 stars 1 forks source link

Doesn't account for @ decorators #15

Open ebailin opened 3 years ago

ebailin commented 3 years ago

I used a number of decorators (@retry, @staticmethod, etc). Rather than keeping them with the functions they were decorating, it put all of them at the top of the script. It would be great if it could keep them properly matched.

Here's a dummy example: original code:

class HelloWorld():

@staticmethod
def print_words(message):
    print(message)

@rety
def keep_printing(message):
   while True: print(message)

became:

class HelloWorld():
@rety
@staticmethod

def keep_printing(message):
 while True: print(message)

def print_words(message):
 print(message)

Ideally, I'd see:

class HelloWorld():
@rety
def keep_printing(message):
 while True: print(message)

@staticmethod
def print_words(message):
 print(message)