【问题标题】:Make Notepad++ collapse Python triple double content?让 Notepad++ 折叠 Python 三重双内容?
【发布时间】:2014-05-29 22:51:35
【问题描述】:

问: 我已经尝试了所有 Notepad++ 首选项和选项以及样式配置器,但我找不到折叠 Python 文档字符串(三双引号之间的内容)的方法。我们可以这样做还是有任何插件来支持这种需求?

上下文: 我决定从 ipython notebook(它是一个在浏览器窗口中运行的交互式 shell)迁移到 Notepad++。 Notepad++ 在自定义编辑环境方面提供了更加灵活的简单原因,并且它具有更好的语法突出显示。

现在我错过了在代码中折叠一大块文档字符串以更好地了解代码结构的功能(通常它们是 OpenCV2 文档,我只是想让它们在脚本中可用,而不需要上网每次我需要参考时都记录下来)。

例如 Netbeans 允许折叠代码块、注释块或 Javadoc。

【问题讨论】:

    标签: python ide notepad++ collapse


    【解决方案1】:

    Notepad++ 将允许您折叠它认为是代码块的任何内容,它根据缩进决定。所以简单的答案是缩进你的文档字符串

    """
        This is a collapsible doc string
    """
    
    
    """This is not"""
    
    """
    Neither is this
    """
    
    """
     This one is, but I think it looks a little odd"""
    

    【讨论】:

      【解决方案2】:

      接受的答案仅适用于文档字符串以及人们愿意调整三重引号文本中的消息的情况。我目前有测试用例,我必须粘贴完整的消息并使用三重双引号。在这种情况下,我不会调整我的多行测试消息,遗憾的是,notepad++ 只会折叠第一段。

          testcases.append("""Lorem Ipsum is simply dummy text of
      the printing and typesetting industry. Lorem Ipsum has been
      the industry's standard dummy text ever since the 1500s, when
      an unknown printer took a galley of type and scrambled it to make
      a type specimen book.
      
      It has survived not only five centuries, but also the leap into
      electronic typesetting, remaining essentially unchanged. It was
      popularized...""")
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-10-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-09-24
        • 2016-01-19
        • 2017-08-28
        相关资源
        最近更新 更多