eir*_*den 358 whitespace visual-studio-code vscode-settings
是否可以在Visual Studio代码中显示空格字符,如空格字符?
似乎没有settings.json它的选项(虽然它是Atom.io中的一个选项),我无法使用CSS显示空白字符.
rev*_*evo 540
VS Code 1.6.0和更高版本
如下面的aloisdg所述,editor.renderWhitespace现在是一个enum采取none,boundary或all.要查看所有空格:
"editor.renderWhitespace": "all",
Run Code Online (Sandbox Code Playgroud)
在VS Code 1.6.0之前
在1.6.0之前,您必须设置editor.renderWhitespace为true:
"editor.renderWhitespace": true
Run Code Online (Sandbox Code Playgroud)
Cod*_*ute 110
它也可以通过主菜单完成 View -> Render Whitespace.之间,我正在使用Visual Studio CodeView -> Render Whitespace
inf*_*k01 60
对于那些愿意使用键盘快捷键切换空白字符的用户,可以在keybindings.json文件中添加自定义绑定(" 文件">"首选项">"键盘快捷键").
示例:
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+shift+i",
"command": "editor.action.toggleRenderWhitespace"
}
]
Run Code Online (Sandbox Code Playgroud)
在这里,我已经指定了Ctrl+ Shift+ 的组合i来切换不可见的字符,你当然可以选择另一种组合.
xgq*_*rms 48
在Visual Studio代码中显示空白字符
通过添加以下代码更改setting.json!
// Place your settings in this file to overwrite default and user settings.
{
"editor.renderWhitespace": "all"
}
Run Code Online (Sandbox Code Playgroud)
Zac*_*k S 27
为了演示editor.renderWhitespace : true将对您的VSCode做的更改,我添加了此屏幕截图:
.
哪里Tab是?和Space有.
alo*_*ica 16
它不再是boolean了.他们换成了enum.:现在我们可以选择none,boundary并且,all.
// Controls how the editor should render whitespace characters,
// posibilties are 'none', 'boundary', and 'all'.
// The 'boundary' option does not render single spaces between words.
"editor.renderWhitespace": "none",
Run Code Online (Sandbox Code Playgroud)
你可以在GitHub上看到原始差异.
它位于View -> Render Whitespace 下。
?? 有时菜单项显示它当前处于活动状态,但您可以看到空白。您应该取消选中并再次检查以使其正常工作。这是一个已知的错误
在mac环境下,你可以在Help菜单下搜索任意菜单选项,就会打开你要找的确切菜单路径。例如,搜索的白色空间,结果如下:
为了使diff显示空白,类似地将其git diff设置diffEditor.ignoreTrimWhitespace为false。 edit.renderWhitespace只是有一点帮助。
// Controls if the diff editor shows changes in leading or trailing whitespace as diffs
"diffEditor.ignoreTrimWhitespace": false,
Run Code Online (Sandbox Code Playgroud)
要更新设置,请转到
文件>首选项>用户设置
Mac用户注意:“首选项”菜单位于“代码而非文件”下。例如,代码>首选项>用户设置。
这将打开一个名为“默认设置”的文件。扩大面积//Editor。现在,您可以看到所有这些神秘editor.*设置的位置。在(CTRL + F)中搜索renderWhitespace。在我的盒子上,我有:
// Controls how the editor should render whitespace characters, posibilties are 'none', 'boundary', and 'all'. The 'boundary' option does not render single spaces between words.
"editor.renderWhitespace": "none",
Run Code Online (Sandbox Code Playgroud)
更令人困惑的是,左侧窗口“默认设置”不可编辑。您需要使用标题为“ settings.json” 的右窗口覆盖它们。您可以将粘贴设置从“默认设置”复制到“ settings.json”:
// Place your settings in this file to overwrite default and user settings.
{
"editor.renderWhitespace": "all",
"diffEditor.ignoreTrimWhitespace": false
}
Run Code Online (Sandbox Code Playgroud)
我最终关掉了车renderWhitespace。
点击F1按钮,然后键入“ Toggle Render Whitespace”或您可以记住的部分:)
我使用的是vscode 1.22.2版,因此该功能可能早在2015年就不存在。
v1.37更新:添加了仅在选定文本内呈现空白的选项。参见v1.37发行说明,渲染空白。
该
editor.renderWhitespace设置现在支持一个selection选项。设置此选项后,空白将仅显示在选定的文本上:
"editor.renderWhitespace": "selection"
Run Code Online (Sandbox Code Playgroud)
和
"workbench.colorCustomizations": {
"editorWhitespace.foreground": "#fbff00"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
177531 次 |
| 最近记录: |