如何在 Visual Studio Code 中隐藏缩进指南?

Posted

技术标签:

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

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

在官方文档中是这样的:

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

【问题讨论】:

你想折叠那几行??? 只是隐藏。我想获得更干净的代码视图。喜欢官方文档中的这个观点 (prntscr.com/iqkmtz) 看这里:code.visualstudio.com/docs/getstarted/keybindings,然后寻找Fold (collapse) 对不起我的语言。我的意思是缩进指南。 检查答案 :) 更新 【参考方案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 > 删除指南缩进的“提示”标记。

【讨论】:

以上是关于如何在 Visual Studio Code 中隐藏缩进指南?的主要内容,如果未能解决你的问题,请参考以下文章

visual studio code如何运行c

Deepin系统中如何安装Visual Studio Code

如何在 Linux 中安装 Visual Studio Code

如何在 Visual Studio Code 中自动获取参数名称?

如何在 Visual Studio Code 中注释多行?

如何在 Visual Studio Code 中隐藏缩进指南?