记一次vscode 自动格式化保存经历
原因是某个插件在保存文本时会自动格式 导致我的条件顺序不对
文件 → 首选项 → 设置 → 右上角「打开设置(json)」
在 .vscode/settings.json
原:
{ "editor.fontLigatures": false, "editor.mouseWheelZoom": true, "python.analysis.completeFunctionParens": true, "terminal.integrated.defaultProfile.windows": "Windows PowerShell", "workbench.colorTheme": "Visual Studio Light", "terminal.integrated.profiles.windows": { "PowerShell": { "source": "PowerShell", "icon": "terminal-powershell" }, "Command Prompt": { "path": [ "${env:windir}\\Sysnative\\cmd.exe", "${env:windir}\\System32\\cmd.exe" ], "args": [], "icon": "terminal-cmd" }, "Git Bash": { "source": "Git Bash" }, "Windows PowerShell": { "path": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" } } }
将
{ "editor.fontLigatures": false, "editor.mouseWheelZoom": true, "python.analysis.completeFunctionParens": true, "terminal.integrated.defaultProfile.windows": "Windows PowerShell", "workbench.colorTheme": "Visual Studio Light", "terminal.integrated.profiles.windows": { "PowerShell": { "source": "PowerShell", "icon": "terminal-powershell" }, "Command Prompt": { "path": [ "${env:windir}\\Sysnative\\cmd.exe", "${env:windir}\\System32\\cmd.exe" ], "args": [], "icon": "terminal-cmd" }, "Git Bash": { "source": "Git Bash" }, "Windows PowerShell": { "path": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" } }, // ===== 下面新增:强制关闭所有插件的「保存时格式化」===== "editor.formatOnSave": false, "prettier.formatOnSave": false, "prettier.requireConfig": true, "eslint.format.enable": false, "editor.codeActionsOnSave": { "source.fixAll.eslint": "never", "source.fixAll": "never" } }

浙公网安备 33010602011771号