Visual Studio Code: How to show line endings

How can I display lineendings (CR,LF) in Visual Studio Code (not in Visual Studio)?

At the moment there is only the little statusbar menu which display/change the line ending if the actual file. But sometimes it would be great to see the line endings directly in every line especially when there are mixed line endings (not good, but this happens from time to time).

I use the following settings, but none of them show the line endings.

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

Is there a setting for lineendings?


I've opened a issue on GitHub: Possibility to display line endings in text area #12223

Soham Kamani made an extensions for this: code-eol


Solution 1:

AFAIK there is no way to visually see line endings in the editor space, but in the bottom-right corner of the window there is an indicator that says "CLRF" or "LF" which will let you set the line endings for a particular file. Clicking on the text will allow you to change the line endings as well.

enter image description here

Solution 2:

If you want to set it to LF as default, you can paste this line in your editor settings (F1 menu; > Preferences: Open Settings (JSON))

"files.eol": "\n"

Example:

{
    "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"
}

Please note that this will change the default line ending for new files only. This will not edit your files.

Solution 3:

Render Line Endings is a Visual Studio Code extension that is still actively maintained (as of September 2021):

https://marketplace.visualstudio.com/items?itemName=medo64.render-crlf

https://github.com/medo64/render-crlf/

It can be configured like this:

{
    "editor.renderWhitespace": "all",
    "code-eol.newlineCharacter": "¬",
    "code-eol.returnCharacter" : "¤",
    "code-eol.crlfCharacter"   : "¤¬",
}

and looks like this:

Enter image description here