简体   繁体   中英

In Atom, is there a package to autoformat long method calls into multi-lines?

In Atom, I'm looking for a way to auto-format long python lines like this:

before:

bar = call_very_long_func_lots_of_params(param1, param2, param3, param4, param5, param6, param7)

after:

bar = call_very_long_func_lots_of_params( param1, param2, param3, param4, param5, param6, param7, )

Are there any packages that help with this? Or any tricks? I find myself tediously taking a while to doing this kind of style formatting and would like to try and be more efficient.

Thanks!

Use the atom default multi select:

highlight the first comma within the parenthesis, and then do ctrl(cmd for mac) + d multiple times until you've highlighted all of , .

Now press right arrow (->) key, you should see cursors after each , .

press enter , which will shift each param to a newline except the first argument, which you can manually shift to newline.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM