visual-studio-code - VS代码: End of file new line not persisting

标签 visual-studio-code newline vscode-settings

我面临一个令人烦恼的问题,尽管明确设置了应该完成的操作,但没有为HTML和JavaScript保存新行。有人可以指导我做错了什么吗?

GitHub Project

Visual Studio Code版本详细信息:

Version 1.23.0
Commit 7c7da59c2333a1306c41e6e7b68d7f0caa7b3d45
Date 2018-05-03T15:23:19.356Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

VS代码设置:

Settings of my Visual Studio Code

最佳答案

这是因为🆚CODE中的默认设置

  // When enabled, insert a final new line at the end of the file when saving it.
  "files.insertFinalNewline": false,

将其设为true,您将可以保留新的一行。我还建议您打开微调器,最后再插入多行。
  • 步骤#1 :按⌘+,(在Windows/Linux上为CTRL)打开设置。
  • 步骤#2 :添加以下两个设置。

    “files.insertFinalNewline”:是的,
    “files.trimFinalNewlines”:true,

  • VSCode.pro setting

    ⚡ Here's a GIF Demo — Save a file to add a line or trim extra lines



    enter image description here

    关于visual-studio-code - VS代码: End of file new line not persisting,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50162952/

    相关文章:

    go - 如何修复 VS Code 错误 : "Not able to determine import path of current package by using cwd" for Go project

    c - C 中的 gets() 函数输入数组

    visual-studio-code - VScode更改行号背景的配置名称是什么?

    python - Visual Studio Code 上的覆盖范围

    Flutter - FAILURE : Build failed with an exception. - 无法启动守护进程。 - 安卓工作室 - VSCode

    typescript - 如何在 Visual Studio Code 版本 1.9.1 中升级 typescript

    java - Java中有 "oldline"字符吗?

    c# - C# 通知中的新行(紧凑型框架)

    VS Code 中的 Python : Can I run cell in the integrated terminal?

    visual-studio-code - 有没有一种方法可以使Visual Studio Code中的注释变为斜体?