简体   繁体   English

在Atom中,是否有一个程序包可以将长方法调用自动格式化为多行?

[英]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: 在Atom中,我正在寻找一种自动格式化长python行的方法,如下所示:

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 , . 突出括号内的第一个逗号,然后执行CTRL(CMD适用于Mac)+ d多次,直到突出显示所有的,

Now press right arrow (->) key, you should see cursors after each , . 现在按right arrow (->)键,您应该在每个,之后都看到光标。

press enter , which will shift each param to a newline except the first argument, which you can manually shift to newline. enter ,这会将每个参数移至换行符,但第一个参数除外,您可以手动将其移至换行符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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