【问题标题】:How can I hide indent guides in Visual Studio Code?如何在 Visual Studio Code 中隐藏缩进指南?
【发布时间】:2018-08-21 16:41:11
【问题描述】:

如何隐藏以下行以获得更清晰的代码视图?

在官方文档中是这样的:

我怎样才能做到这一点或在文档中找到设置?

【问题讨论】:

标签: visual-studio-code vscode-settings


【解决方案1】:

Ctrl + Shift + p,输入settings并选择Preferences: Open Settings (JSON)打开用户设置,然后添加:

// Controls whether the editor should render indent guides
  "editor.renderIndentGuides": false,

这将禁用缩进指南。

请参阅documentation for User Settings

【讨论】:

  • 您也可以通过导航到 File -> Preferences -> Settings 访问此文件,正如 Sajeetharan 在他的回答中提到的那样。
  • 我已经更新了我的答案,所以它是根据 OP 面临的真正问题。
  • editor.renderIndentGuides 已被弃用,取而代之的是 editor.guides.indentation in version 1.6.1
【解决方案2】:

我尝试了以前的答案,但它不会让我,因为它说文件是只读的,所以我找到的解决方案如下:

点击菜单文件首选项设置

在搜索框中,输入“render indent guides”(不带""

取消勾选显示“控制编辑器是否应呈现缩进指南”的框

这将删除缩进指南。

【讨论】:

  • 这是真正的答案...代码折叠 + 没有缩进线。
  • 如果您还想去掉“取消选择渲染缩进指南”后出现的点,请将“渲染空白”设置更改为无。
【解决方案3】:

这是一种隐藏缩进行但保留活动行指示符的方法。

将此添加到settings.json

"workbench.colorCustomizations": {
  "editorIndentGuide.background": "#00000000" // hide via 100% transparency.
}

只有活动的缩进块可见。

要控制活动线的颜色,请添加...

"editorIndentGuide.activeBackground": "#444444b9" // Grey with some transparency.

【讨论】:

  • 超级有帮助。谢谢。
  • 这非常整洁。谢谢!
【解决方案4】:

已解决: "editor.renderIndentGuides": false

【讨论】:

  • 哦,你说的是代码折叠,所以我认为你的意思是折叠按钮。
  • 哥们,你的问题和答案完全不同
  • @Sajeetharan 对不起我的语言。
【解决方案5】:

前往

菜单文件首选项设置

然后搜索 "editor.folding"。设置为

"editor.folding": false

这将禁用线条和折叠功能。

由于您要禁用渲染缩进指南,

来自documentation

  "editor.renderIndentGuides": false,

这将禁用缩进指南。

【讨论】:

    【解决方案6】:

    方法一(使用 settings.json)

    "editor.renderIndentGuides": false, 现在在 vs 代码中已弃用

    请改用"editor.guides.indentation": false


    方法 2(使用设置 UI)

    转到设置 > 搜索 editor.guides.indentation > 删除指南缩进的“提示”标记。

    【讨论】:

      猜你喜欢
      • 2022-07-18
      • 2016-06-14
      • 1970-01-01
      • 1970-01-01
      • 2015-10-13
      • 1970-01-01
      • 2016-03-14
      • 1970-01-01
      • 2016-06-02
      相关资源
      最近更新 更多