Duplicate should also duplicates source code formatting

I notice duplicate function does not duplicate the code formatting of duplicated element. I suggest duplication also duplicates the code formatting so that the source code looks nicer and well arranged.