顯示具有 vscode 標籤的文章。 顯示所有文章
顯示具有 vscode 標籤的文章。 顯示所有文章

2022年9月25日 星期日

vscode 刪除空格 (Remove trailing spaces)

使用 vscode 自動刪除空格的原因

當你上 code 時,有 reviewer 看你的程式碼時,通常會用 meld 等軟體 review。當你的程式碼加了多餘的空格時,都會被這些程式碼 highlight,使得 reviewer 在查看你的程式碼時有一定的不便。

vscode 刪除空格

  • 手動刪除空格 (Remove trailing spaces manually)
    ctrl + alt + p,輸入 trail 你應該就可以看到相關快捷鍵。
  • 自動刪除空格 (Remove trailing spaces automatically)
    setting > 右上角的 open setting (JSON) > 加入以下這行。
        "files.trimTrailingWhitespace": true
    
參考資料 :
1.remove-trailing-spaces-automatically-or-with-a-shortcut

Popular Posts