Visual Studio代码:如何显示行结尾

问题描述 投票:130回答:3

如何在Visual Studio代码中显示lineendings(CR,LF)(不在Visual Studio中)。

我使用以下设置,但不使用它们显示行结尾。

"editor.renderWhitespace": true,
"editor.renderControlCharacters": true,
"editor.renderIndentGuides": true

行结尾有设置吗?

编辑1:我在GitHub上打开了一个问题:https://github.com/Microsoft/vscode/issues/12223

编辑2:Soham Kamani对此进行了扩展:code-eol

visual-studio-code
3个回答
276
投票

AFAIK无法直观地看到编辑器空间中的行结尾,但是在窗口的右下角有一个指示符“CLRF”或“LF”,它可以让您设置特定文件的行结尾。单击文本也可以更改行结尾。

enter image description here


65
投票

如果要将其设置为默认值LF,可以转到文件 - >首选项 - >设置,在用户设置下,您可以将此行粘贴到其他用户设置下方。

“fil.eol”:“六月”

例如。

"git.confirmSync": false,
"window.zoomLevel": -1,
"workbench.activityBar.visible": true,
"editor.wordWrap": true,
"workbench.iconTheme": "vscode-icons",
"window.menuBarVisibility": "default",
"vsicons.projectDetection.autoReload": true,
"files.eol": "\n"

12
投票

有一个显示行结尾的扩展名。您可以配置使用的颜色,表示CRLF和LF的字符以及打开和关闭它的布尔值。

Name: Line endings 
Id: jhartell.vscode-line-endings 
Description: Display line ending characters in vscode 
Version: 0.1.0 
Publisher: Johnny Härtell 

VS Marketplace Link

© www.soinside.com 2019 - 2024. All rights reserved.