【发布时间】:2018-05-06 10:38:30
【问题描述】:
如何在 Visual Code 中禁用 cmets 的格式设置?我使用 JSX/React。格式化代码后,cmets 也会重新对齐。如何避免这种情况?
评论应该保持原样(应该被忽略)。应该调整哪个设置?
【问题讨论】:
-
这不是标准的 VS Code 行为。它来自您的一个扩展程序
标签: reactjs visual-studio-code
如何在 Visual Code 中禁用 cmets 的格式设置?我使用 JSX/React。格式化代码后,cmets 也会重新对齐。如何避免这种情况?
评论应该保持原样(应该被忽略)。应该调整哪个设置?
【问题讨论】:
标签: reactjs visual-studio-code
如果您正在使用此插件/扩展。 https://github.com/kokororin/vscode-phpfmt
有一个选项“RestoreComments”可以不修改/触摸评论块。
文件 |偏好 |设置
{
"phpfmt.psr2": true,
"phpfmt.visibility_order": true,
"phpfmt.passes": [
"PSR2KeywordsLowerCase",
"PSR2LnAfterNamespace",
"PSR2CurlyOpenNextLine",
"PSR2ModifierVisibilityStaticOrder",
"PSR2SingleEmptyLineAndStripClosingTag",
"ReindentSwitchBlocks",
"SpaceAfterExclamationMark",
"ReplaceBooleanAndOr",
"RestoreComments",
"GeneratePHPDoc"
],
"phpfmt.exclude": [
"ReindentComments",
"StripNewlineWithinClassBody"
],
"[php]": {
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.autoIndent": true,
"editor.formatOnSave": true
}
}
【讨论】: