PyCharm 代码折叠/大纲生成错误的边界 [英] PyCharm Code Folding/Outlining Generates Wrong Boundaries

查看:31
本文介绍了PyCharm 代码折叠/大纲生成错误的边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 PyCharm 时遇到了一个非常令人沮丧的问题,因为它不想正确地概述代码以便块正确折叠.我已经找遍了所有地方,但找不到任何有关此特定问题的帮助.简而言之,PyCharm 似乎决定了倾斜的块边界,以便块相互折叠.这很令人恼火.有什么想法吗?

I'm having a very frustrating issue with PyCharm in that it does not want to properly outline the code so that blocks fold correctly. I've looked all over the place and couldn't find any help with this particular problem. In a nutshell, PyCharm seems to decide on skewed block boundaries so that the blocks fold up on each other. It's quite irritating. Any thoughts?

尝试折叠 _get_thread_name 会产生以下结果:

Trying to collapse _get_thread_name yields this:

推荐答案

终于!我想出了如何删除无效的折叠区域.如果您将光标放在开始无效折叠块的行(在我的第一个示例中为第 106 行),则右键单击该行中的任意位置并选择 Folding ->折叠选择/删除区域,这将删除不正确的折叠注释!

Finally!! I figured out how to remove the invalid folding regions. If you place your cursor on the line that starts an invalid folding block (line 106 in my first example), then right click anywhere in that line and select Folding -> Fold Selection / Remove Region and that will delete the incorrect folding annotation!

我仍然不知道为什么它们会首先生成,但至少这是一个不错的修复".

I still have no clue why they are generated in the first place, but at least this is a decent "fix".

这篇关于PyCharm 代码折叠/大纲生成错误的边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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