在 PyCharm 中用换行符包装注释 [英] Wrapping comments with line breaks in PyCharm

查看:54
本文介绍了在 PyCharm 中用换行符包装注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的评论有气球(PEP 8: Line too long ... > 120)我希望有一个命令可以用很少的按键来换行.现在,即使我在 Reformat file 上输入 Alt+Enter 并按 enter ,实际上也没有任何变化.有没有设置或插件可以让我轻松完成格式化?

I have comments that gets balloon (PEP 8: Line too long ... > 120) I wish there was a command that will wrap the lines with few keystrokes. Right now, even if I type Alt+Enter and press enter on Reformat file, nothing actually changes. Is there a setting or plugin I could use to accomplish the formatting easily?

推荐答案

首先,重新格式化是行不通的,至少在 Python 中不行,因为空格很重要.PyCharm 的打字到达右边距时换行"选项正是您要找的.现在这在你复制粘贴代码时不起作用,但在它给你带来麻烦的地方,只需按回车,它就会起作用.

Firstly, reformatting won't work, not in Python at least, where whitespace is important. PyCharm's "Wrap when typing reaches right margin" option is what you're looking for. Now this will not work when you copy and paste code, but in the places where it gives you trouble, just press enter, and it will work.

这篇关于在 PyCharm 中用换行符包装注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆