Visual Studio Code: How to show line endings

前端 未结 4 903
星月不相逢
星月不相逢 2020-11-30 19:06

How can i display lineendings (CR,LF) in Visual Studio Code (not in Visual Studio).

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



        
相关标签:
4条回答
  • 2020-11-30 19:24

    Render Line Endings is a VS Code extension that is still actively maintained (as of Apr 2020):

    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:

    0 讨论(0)
  • 2020-11-30 19:36

    There's an extension that shows line endings. You can configure the color used, the characters that represent CRLF and LF and a boolean that turns it on and off.

    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

    0 讨论(0)
  • 2020-11-30 19:37

    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.

    0 讨论(0)
  • 2020-11-30 19:44

    If you want to set it to LF as default, you can go to File->Preferences->Settings and under user settings you can paste this line in below your other user settings.

    "files.eol": "\n"

    For 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"
    
    0 讨论(0)
提交回复
热议问题