簡體   English   中英

使Notepad ++折疊Python的三重內容嗎?

[英]Make Notepad++ collapse Python triple double content?

問:我已經嘗試了所有的Notepad ++首選項和選項以及樣式配置器,但是找不到折疊Python docstring(三重雙引號之間的內容)的方法。 我們可以這樣做嗎,或者有任何插件可以支持這種需求?

上下文:我決定從ipython筆記本(這是在瀏覽器窗口中運行的交互式外殼)遷移到Notepad ++。 Notepad ++在自定義編輯環境中提供更加靈活的簡單原因,並且具有更好的語法突出顯示。

現在我錯過了折疊代碼中的一部分文檔字符串以更好地了解代碼結構的功能(通常它們是OpenCV2文檔,我只想在腳本中使用它們,而不必每次都訪問在線文檔我需要參考)。

例如, Netbeans允許折疊代碼塊,注釋塊或Javadoc。

Notepad ++允許您折疊它認為是縮進的代碼塊,而不用考慮它是代碼塊。 因此,簡單的答案是縮進您的文檔字符串

"""
    This is a collapsible doc string
"""


"""This is not"""

"""
Neither is this
"""

"""
 This one is, but I think it looks a little odd"""

可接受的答案僅解決文檔字符串,並且在人們願意調整三引號引起的文本中的消息的情況下。 我目前有一些測試用例,必須粘貼完整的消息,並使用三重雙引號。 在這種情況下,我不會調整多行測試消息,可悲的是,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...""")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM