vscode 自动清理yaml 多余空格的方法

172 阅读1分钟

参考该链接: dotjesper.com/2024/how-to….

vscode 自动清理yaml 多余空格的方法, 可以参考这个链接进行配置,然后在 yaml 文件中保存动作 会触发尾部空格清理,十分简单方便

image.png

Alternatively you can use the keyboard shortcut F1 or Ctrl + Shift + P to open the Command Palette, and type Open User Settings (JSON) and press Enter. If you want to see all available settings, type Open Default Settings (JSON) and press Enter.

Configure Visual Studio Code to automatically trim trailing whitespace on save

// When enabled, will trim trailing whitespace when saving a file.
"files.trimTrailingWhitespace": false,

Configure how Visual Studio Code render whitespace characters

// Controls how the editor should render whitespace characters.
//  - none
//  - boundary: Render whitespace characters except for single spaces between words.
//  - selection: Render whitespace characters only on selected text.
//  - trailing: Render only trailing whitespace characters.
//  - all
"editor.renderWhitespace": "trailing",

Configure how Visual Studio Code handle changes in leading or trailing whitespace

// When enabled, the diff editor ignores changes in leading or trailing whitespace.
"diffEditor.ignoreTrimWhitespace": false,

Configure Visual Studio Code to trim any trailing new lines at the end of a file upon saving

// When enabled, will trim all new lines after the final new line when saving it.
"files.trimFinalNewlines": true,

Happy coding.