本文介绍了如何在UNIX之类的Visual Studio Code中使所有文件中的所有行尾(EOL)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我使用Windows 10家庭版,通常使用Visual Studio Code(VSCODE)编辑Linux Bash脚本以及PHP和JavaScript。

I use Windows 10 home and I usually use Visual Studio Code (VSCODE) to edit Linux Bash scripts as well as PHP and JavaScript.

我不开发Windows专用的任何工具,我都不会介意我编辑的所有文件的默认EOL都是Unix之类的(nix)。

I don't develop anything dedicated for Windows and I wouldn't mind that the default EOLs for all files I edit whatsoever would be Unix like (nix).

我如何确保所有EOL ,在所有文件中(无论从任何文件扩展名开始),在VSCODE中都是nix吗?

How could I ensure that all EOLs, in all files whatsoever (from whatever file extension), are nix, in VSCODE?

我问过我这个问题已经在Windows中使用VSCODE编写了一些Bash脚本,并将它们作为项目的一部分上传到GitHub,一位审查该项目的高级程序员告诉我,我在那里有 Windows EOL ,还有一个 BOM 问题,如果我将EOL更改为nix(或者至少是我所理解的),我可以解决。

I ask this question after I've written a few Bash scripts in Windows with VSCODE, uploaded them to GitHub as part of a project, and a senior programmer that reviewed the project told me I have Windows EOLs there and also a BOM problem that I could solve if I'll change the EOLs there to be nix (or that's what I understood, at least).

因为我的所有开发都是面向Linux的,所以我希望默认情况下,即使我编辑的任何文件都将包含nix EOL t的窗口是唯一的。

Because all my development is Linux-oriented, I would prefer that by default, any file I edit would have nix EOLs, even if it's Window unique.

推荐答案

在项目首选项中,添加/编辑以下配置选项:

In your project preferences, add/edit the following configuration option:

"files.eol": "\n"

这是从提交开始添加的

注意:即使文件中只有一个 CRLF ,以上设置将被忽略,整个文件将转换为 CRLF 。您首先需要将所有 CRLF 转换为 LF ,然后才能在Visual Studio Code中将其打开。

Note: Even if you have a single CRLF in the file, the above setting will be ignored and the whole file will be converted to CRLF. You first need to convert all CRLF into LF before you can open it in Visual Studio Code.

另请参阅:

这篇关于如何在UNIX之类的Visual Studio Code中使所有文件中的所有行尾(EOL)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-09 02:58