Visual studio code 如何在保存在VS代码中的上重新插入代码?

Visual studio code 如何在保存在VS代码中的上重新插入代码?,visual-studio-code,vscode-settings,Visual Studio Code,Vscode Settings,在VS代码中,我已安装并启用了美化 我在我的电脑上测试了一个php文件 当我按下save键时,我无法进行修复或美化 我错过了什么 代码>用户>设置.json 我只想在保存时重新保存代码。对于Windows,请单击“文件”->“首选项”->“设置”。然后搜索editor.formatOnSave,并将“true”改为“false” 对于Mac,单击“代码”(屏幕左上角“文件”、“编辑”和“视图”左侧)->首选项->设置->在页面顶部的搜索设置框中输入术语“editor.formatOnSav

在VS代码中,我已安装并启用了美化

我在我的电脑上测试了一个php文件

当我按下save键时,我无法进行修复或美化

我错过了什么

代码>用户>设置.json
我只想在保存时重新保存代码。

对于Windows,请单击“文件”->“首选项”->“设置”。然后搜索editor.formatOnSave,并将“true”改为“false”

对于Mac,单击“代码”(屏幕左上角“文件”、“编辑”和“视图”左侧)->首选项->设置->在页面顶部的搜索设置框中输入术语“editor.formatOnSave”。单击勾号将其标记为true


src:

对于Windows,请单击“文件”->首选项->设置。然后搜索editor.formatOnSave,并将“true”改为“false”

对于Mac,单击“代码”(屏幕左上角“文件”、“编辑”和“视图”左侧)->首选项->设置->在页面顶部的搜索设置框中输入术语“editor.formatOnSave”。单击勾号将其标记为true


src:

来自美化扩展回购:

在Visual Studio代码中美化
javascript
JSON
CSS
Sass
HTML

您正在尝试格式化PHP代码

我推荐。它在保存时很好地格式化了我的文件

保存前:

保存后:

重要提示:仅在文件不包含关闭标记时格式化文件。您必须删除结束标记。发件人:

如果文件只包含PHP代码,最好省略文件末尾的PHP结束标记。这可以防止在PHP结束标记后意外添加空格或新行,这可能会造成不必要的影响,因为当程序员无意在脚本中的该点发送任何输出时,PHP将开始输出缓冲


从美化扩展回购协议:

在Visual Studio代码中美化
javascript
JSON
CSS
Sass
HTML

您正在尝试格式化PHP代码

我推荐。它在保存时很好地格式化了我的文件

保存前:

保存后:

重要提示:仅在文件不包含关闭标记时格式化文件。您必须删除结束标记。发件人:

如果文件只包含PHP代码,最好省略文件末尾的PHP结束标记。这可以防止在PHP结束标记后意外添加空格或新行,这可能会造成不必要的影响,因为当程序员无意在脚本中的该点发送任何输出时,PHP将开始输出缓冲


相同的问题已在上列出

根据他们的回复

Beautify不支持PHP

如果你想美化
PHP
文件,你必须使用不同的插件, 例如:


相同的问题已在

根据他们的回复

Beautify不支持PHP

如果你想美化
PHP
文件,你必须使用不同的插件, 例如:


这不是针对javascript的吗?为什么在PHP中使用它为什么不在PHP中使用prettier:这不是javascript吗?为什么要在PHP中使用它为什么不在PHP中使用prettier:
“editor.formatOnSave”:true
已经存在,如果您查看问题
settings.json
source,就会看到它。
“editor.formatOnSave”:true
已经存在,如果您查看问题
settings.json
source,就会看到它。
{
  "workbench.startupEditor": "newUntitledFile",
  "window.zoomLevel": 1,
  "editor.fontSize": 14,
  "terminal.integrated.fontSize": 11,
  "extensions.ignoreRecommendations": true,
  // syncedSideBar
  "explorer.autoReveal": true,
  // Is git enabled
  "git.enabled": false,
  // Path to the git executable
  "git.path": null,
  // Whether auto fetching is enabled.
  "git.autofetch": false,
  "workbench.statusBar.visible": false,
  "workbench.activityBar.visible": true,
  "eslint.autoFixOnSave": true,
  "explorer.confirmDelete": false,
  "explorer.confirmDragAndDrop": false,
  "workbench.colorTheme": "Monokai",
  "javascript.updateImportsOnFileMove.enabled": "always",
  "openInGitHub.providerType": "github",
  "gitlens.advanced.messages": {
    "suppressGitDisabledWarning": true
  },
  "liveServer.settings.donotShowInfoMsg": true,
  "window.closeWhenEmpty": false,
  "editor.emptySelectionClipboard": false,
  "editor.dragAndDrop": false,
  "editor.fontFamily": "Source Code Pro",
  "editor.selectionHighlight": false,
  "window.openFilesInNewWindow": "off",
  "workbench.editor.enablePreview": true,
  "editor.scrollBeyondLastLine": false,
  "editor.mouseWheelScrollSensitivity": 5,
  "window.title": "${activeEditorFull}${separator}${rootName}",
  "editor.tabSize": 4,
  "files.trimTrailingWhitespace": true,
  "editor.useTabStops": true,
  "editor.wordWrap": "on",
  "editor.formatOnPaste": false,
  "editor.multiCursorModifier": "ctrlCmd",
  "editor.snippetSuggestions": "top",
  "vsicons.dontShowNewVersionMessage": true,
  "files.autoSave": "afterDelay",
  "editor.formatOnType": false,
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}