news 2026/2/26 12:52:48

VSCode - 显示EOL字符的插件

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
VSCode - 显示EOL字符的插件

VSCode自身没有显示EOL字符的功能,可以通过扩展插件来实现。

在插件市场搜索到:Render Line Endings

点击安装,Publisher:Josip Medved,选择相信第一次从此publisher安装程序。

This extension renders end of line characters (CR, LF, CRLF) when whitespace rendering is on.

Installation

* Press CTRL P or COMMAND P

* Writeext install medo64.render-crlf

* PressEnter

Features

* Renders end of line characters: CR, LF, CRLF

Note: CR files are not supported by VS Code. See Upstream Issues

* Only renders visible portions of text, which makes it very fast even for huge documents

* The characters used to render EOL can be customized

* Respects the value ofeditor.renderWhitespace

* The option can be toggled withView > Appearance > Render Whitespaceor from the Command Palette

* An example with editor.renderWhitespace: selection:

* Can be configured to highlight non-standard EOL only:

* Can be configured to highlight trailing whitespace only:

* Configuration options can be set per language

* Uses colors from the current theme:

* "editorWhitespace.foreground": Rendered characters

* "errorForeground": Non-standard EOL and trailing whitespace, if configured

Settings

This extension contributes the following settings (compatible withcode-eolextension):

Setting

Default

Description

"code-eol.newlineCharacter"

"↓"

Character used to display LF, Linux and Mac's line ending.

"code-eol.returnCharacter"

"←"

Character used to display CR, old Macintosh' line ending.

Note: CR files are not supported by VS Code: see microsoft/vscode#35797.

"code-eol.crlfCharacter"

"↵"

Character used to display CRLF, Windows' line ending.

"code-eol.highlightNonDefault"

false

If set, non-standard line endings will be highlighted as errors.

The standard EOL is taken from files.eol.

"code-eol.highlightExtraWhitespace"

false

If set, trailing whitespace will be highlighted as errors.

"code-eol.decorateBeforeEol"

false

If set, rendered characters will come before the end of the line.

Note: If set, line endings will not be rendered on empty lines.

"code-eol.forceShowOnWordWrap"

false

If set, rendered characters will always be shown when word wrap is on, regardless of the other settings.

"code-eol.forceShowOnBoundary"

false

If set, rendered characters will always be shown when in boundary mode.

"code-eol.colors.default.foreground"

(theme)

If set, used instead of theme default for coloring EOL characters

"code-eol.colors.error.foreground"

(theme)

If set, used instead of theme default for highlighting different EOL characters and extra whitespace

>Configuration Examples

Here are examples of a few most common adjustments.

>>Render All Whitespace

It's perfectly fine to use View -> Appearance -> View whitespace and for that you don't need to edit any settings. However, if you want to permanently turn whitespace on, you can do so:

{

"editor.renderWhitespace": "all",

}

>>Custom colors

You can override theme defaults, if so desired.

{

"code-eol.colors.default.foreground": "#007000",

"code-eol.colors.error.foreground": "#700000",

}

>>Alternate EOL Characters

If you don't like default characters, you can select any unicode character you like. For example, if you want it to look similar to Atom, you can use something like this:

{

"code-eol.newlineCharacter": "¬",

"code-eol.returnCharacter" : "¤",

"code-eol.crlfCharacter" : "¤¬",

}

(default characters are ↓, ←, and ↵).

Highlight Non-standard EOL:

If you want to highlight files that have different ending than defined in files.eol, you can set code-eol.highlightNonDefault:

{

"code-eol.highlightNonDefault": true,

}

Highlight Trailing Whitespace Only:

If you want to highlight trailing whitespace (either spaces or tab), there's a setting for that:

{

"code-eol.highlightExtraWhitespace": true,

}

>Upstream Issues

Please upvote the following VS Code issues:

Mixed Line Endings Are Not Supported (microsoft/vscode#127)

VS Code normalizes line endings of mixed files upon load, and thus this extension will always show one kind of EOL character.

>>CR Line Ending Is Not Supported (microsoft/vscode#35797)

VS Code does not support the CR line ending. Therefore, while you can configure it, you will never see CR as a line ending.

>>Not Rendering Glyphs For Large Files (microsoft/vscode#27100)

For performance reasons VS Code doesn't synchronize files that are over 5MB in size. Therefore, no line-ending characters will be visible on large files.

To avoid this you can set:

"editor.largeFileOptimizations": false

// some other symbols you might want to use:

// ¤

// ↓

// ←

// ↙

// ⇣

// ⇠

// ⇓

// ⇐

// ▼

// ◀

// ␤

// ¶

// ↲

// ↩

// ↴

// ⬎

// ⇂

// see more at https://unicode-table.com/en/sets/arrows-symbols/

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/2/24 13:53:37

树莓派5安装ROS2常见内核版本冲突及解决策略

树莓派5安装ROS2踩坑实录:内核冲突的根源与实战解决方案 你是不是也遇到过这种情况?兴致勃勃地把树莓派5通上电,烧好镜像,准备大干一场——结果刚运行 ros2 run 就崩了;或者编译自定义节点时莫名其妙报错“undefine…

作者头像 李华
网站建设 2026/2/23 7:25:37

i.MX硬件加速集成指南:Yocto环境配置

i.MX硬件加速集成实战:从Yocto环境搭建到系统验证你有没有遇到过这样的场景?手头的i.MX8M Plus开发板明明配备了NPU和VPU,但跑起AI模型来速度还不如树莓派;用GStreamer播放4K视频时CPU占用飙到90%以上——这说明,你的硬…

作者头像 李华
网站建设 2026/2/24 18:45:25

一文说清树莓派5与树莓派4引脚定义的核心变化

深度解析树莓派5引脚定义的五大关键变化:从兼容性陷阱到主动控制的跃迁你有没有遇到过这样的情况?一个在树莓派4上运行完美的HAT扩展板,插到全新的树莓派5上却“失灵”了——IC设备检测不到、按钮关机失效,甚至一通电就反复重启&a…

作者头像 李华
网站建设 2026/2/22 5:13:37

嵌入式工控机中USB协议的配置手把手教程

嵌入式工控机中USB协议配置实战指南:从原理到稳定通信的完整路径在工业自动化现场,你是否遇到过这样的场景?一台嵌入式工控机接上扫码枪却毫无反应;插入U盘后系统日志里只有一串“enumeration failed”;摄像头刚识别出…

作者头像 李华
网站建设 2026/2/24 13:30:05

电路仿真circuits网页版在模拟信号调理中的实践解析

用网页电路仿真玩转模拟信号调理:从零搭建心电前置放大器你有没有过这样的经历?手头有个传感器项目,信号微弱得像耳语,噪声却吵得像工地施工。想做个放大滤波电路,可一上电就失真、振荡、输出贴电源轨……改一次PCB要等…

作者头像 李华
网站建设 2026/2/20 19:09:03

零基础小白指南:Python打造简易上位机软件

从零开始,用Python写一个能和单片机对话的上位机 你有没有过这样的经历? 手里的STM32或Arduino正在跑传感器数据,串口助手里一堆跳动的数字看得眼花缭乱,却没法保存、不能画图、也不够“专业”。你想做个专属监控界面&#xff0c…

作者头像 李华