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

问题描述 投票:0回答:7

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

Enter image description here

官方文档是这样的:

Enter image description here

我该如何做到这一点或在文档中找到设置?

visual-studio-code
7个回答
60
投票

Ctrl + Shift + p,输入

settings
并选择
Preferences: Open Settings (JSON)
打开 用户设置,然后添加以下内容:

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

这将禁用缩进参考线。

请参阅用户设置文档

编辑:截至2022年5月30日,此设置称为

  "editor.guides.indentation": false,

21
投票

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

单击菜单 文件首选项设置

在搜索框中,输入“渲染缩进参考线”(不带

""

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

enter image description here

这将删除缩进参考线。


16
投票
这是隐藏缩进线但保留活动行指示器的方法。

将此添加到

settings.json

"workbench.colorCustomizations": { "editorIndentGuide.background": "#00000000" // hide via 100% transparency. }
只有活动的缩进块才是可见的。

only active guide showing

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

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

10
投票

方法1(使用settings.json)

"editor.renderIndentGuides": false,

 现在在 VS Code 中
已弃用

请使用

"editor.guides.indentation": false

 来代替。


方法2(使用设置UI)

转到设置 > 搜索

editor.guides.indentation

 > 删除参考线缩进的“提示”标记。


3
投票
已解决: “editor.renderIndentGuides”: false


3
投票
前往

菜单

文件首选项设置

并搜索

"editor.folding"

。将其设置为

"editor.folding": false


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

由于您想禁用渲染缩进参考线,

来自

文档

"editor.renderIndentGuides": false,
这将禁用缩进参考线。


0
投票
您可以从

settings.json

 中完全隐藏缩进引导线。

cmd

ctrl + shift + P 导航至您的 settings.json,然后输入 settings.json
,然后按 
Enter

然后粘贴以下代码:

"editor.guides.indentation": false,
    
© www.soinside.com 2019 - 2024. All rights reserved.