【问题标题】:Visual Studio Code - Ignore formatting of comments in JSXVisual Studio Code - 忽略 JSX 中的注释格式
【发布时间】:2018-05-06 10:38:30
【问题描述】:

如何在 Visual Code 中禁用 cmets 的格式设置?我使用 JSX/React。格式化代码后,cmets 也会重新对齐。如何避免这种情况?

格式化前:

格式化后:

评论应该保持原样(应该被忽略)。应该调整哪个设置?

【问题讨论】:

  • 这不是标准的 VS Code 行为。它来自您的一个扩展程序

标签: reactjs visual-studio-code


【解决方案1】:

如果您正在使用此插件/扩展。 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
    }
}

【讨论】:

    猜你喜欢
    • 2023-02-17
    • 1970-01-01
    • 2017-04-18
    • 1970-01-01
    • 2020-12-11
    • 2018-12-11
    • 1970-01-01
    • 2015-04-01
    • 2020-02-06
    相关资源
    最近更新 更多