【问题标题】:Visual Studio Code - How to prevent comment foldingVisual Studio Code - 如何防止注释折叠
【发布时间】:2020-02-01 14:16:19
【问题描述】:

我喜欢在 Visual Studio 代码中折叠我的代码,但我希望我仍然可以看到包含多行的注释块。我将它们用于我的函数和类。有没有办法做到这一点?

例如我有这段代码:

    /**
    * setMinimize() - Minimize my window
    */
    setMinimize() {
        this.win.minimize()
    }

现在我使用折叠并发生以下情况:

    /**...
    setMinimize() {...
    }

其实我很想实现这个(这样我仍然可以看到我的评论区):

    /**
    * setMinimize() - Minimize my window
    */
    setMinimize() {...
    }

编辑:我忘了说我使用了“fold all”或“fold level 2”选项。

【问题讨论】:

  • 不知道你的意思,评论和代码块对我来说是单独折叠的,你不能同时折叠两个
  • 哦,我的错,我忘了说我使用了“fold all”或“fold level 2”选项。
  • 有什么解决办法吗?真的很烦人!我很想找到一些解决方法...

标签: javascript visual-studio-code fold folding code-folding


【解决方案1】:

如果您使用 ctrl+k 和 ctrl+f 格式化代码,注释部分将可见且不会关闭 还可以看到这个格式良好的代码示例

/*** This code ***/
#seo-card1 canvas,
#seo-card2 canvas {
  height: 150px !important;
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
  @media only screen and (max-width: 768px) {
    padding-bottom: 30px;
  }
}

【讨论】:

  • 我忘了在上面提到,我使用的是“fold all”或“fold level x”选项。
  • @borsTiHD 请访问此链接它可能会有所帮助link
  • 感谢您的链接。但我不知道它有什么帮助。他们在谈论 Lazarus IDE。在 VS 代码中有 2 个提示我不知道该怎么做。第一个:Comments can be toggled, by making a selection, and then using the context/pop-up menu, above the fold-part of the gutter. 第二个:To set this, go to "Environment" - "Options" - "Code Folding". Uncheck everything except "Procedure" and click "OK".
猜你喜欢
  • 2010-11-20
  • 1970-01-01
  • 2021-08-23
  • 2021-05-09
  • 2016-03-22
  • 1970-01-01
  • 2018-07-31
  • 2015-07-16
  • 2017-04-29
相关资源
最近更新 更多