VS代码格式在JSON文件中拆分逗号分隔的项目

时间:2019-05-30 15:59:01

标签: json visual-studio-code vscode-settings

VS Code希望将逗号分隔的参数拆分为单独的行。我希望它不这样做。它只会在一台机器上发生,而我无法发现导致这种情况发生的设置。

例如,请考虑settings.json

中的这段文字
"args": [
    "-q", "query",
    "-a", "answer"
]

我打开了保存格式,每次保存文件时,都会得到这个

"args": [
    "-q",
    "query",
    "-a",
    "answer"
]

我希望它像我所有其他机器一样,不理会这些。请注意,我不想关闭自动格式化,我只是想停止这种换行行为。

[新信息] 我将用户设置~/Library/Application Support/Code/User/settings.json从没有包装问题的机器复制到了有问题的机器。我不确定它是哪个设置,但是可以解决问题。我仍然很想知道是哪种设置导致了此行为。这两个文件都在下面。

包装问题设置

{
    "telemetry.enableTelemetry": false,
    "editor.minimap.enabled": false,
    "files.autoSave": "afterDelay",
    "workbench.sideBar.location": "left",
    //"editor.wordWrap": "bounded",
    "editor.wordWrapColumn": 132,
    "editor.wrappingIndent": "deepIndent",
    "go.formatTool": "goimports",
    "go.liveErrors": {
        "enabled": true,
        "delay": 500
    },
    "go.vetOnSave": "workspace",
    "go.gocodeAutoBuild": true,
    "git.enableCommitSigning": true,
    "go.autocompleteUnimportedPackages": true,
    "git.autofetch": true,
    "git.confirmSync": false,
    "editor.formatOnPaste": true,
    "editor.formatOnType": true,
    "editor.formatOnSave": true,
    "python.testing.unittestEnabled": true,
    "python.venvPath": "~/develop/virtualenv",
    "python.linting.pep8Enabled": true,
    "editor.detectIndentation": false,
    "search.quickOpen.includeSymbols": true,
    "workbench.colorTheme": "Default Light+",
}

无包装问题设置

{
    "telemetry.enableTelemetry": false,
    "window.zoomLevel": 0,
    "files.autoSave": "afterDelay",
    "editor.fontSize": 14,
    "editor.minimap.enabled": false,
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "editor.wordWrap": "on",
    "editor.wrappingIndent": "deepIndent",
    "editor.wordWrapColumn": 132,
    "go.autocompleteUnimportedPackages": true,
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "go.gocodeAutoBuild": true,
    "debug.enableAllHovers": true,
    "debug.inlineValues": true,
    "git.enableCommitSigning": true,
    "python.jediEnabled": false,
    "[python]": {

    },
    "python.testing.unittestEnabled": true,
    "git.autofetch": true,
    "python.venvPath": "~/develop/virtualenv",
    "python.linting.pep8Enabled": true,
    "editor.detectIndentation": false,
    "editor.formatOnPaste": true,
    "window.openFilesInNewWindow": "on",
}

删除重复项的组合设置

paul-> cat settings.json.old.json settings.json |sort|uniq

        "**/.classpath": true,
        "**/.factorypath": true
        "**/.project": true,
        "**/.settings": true,
        "delay": 500
        "enabled": true,
    "[python]": {
    "debug.enableAllHovers": true,
    "debug.inlineValues": true,
    "editor.detectIndentation": false,
    "editor.fontSize": 14,
    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.minimap.enabled": false,
    "editor.suggestSelection": "first",
    "editor.wordWrap": "on",
    "editor.wordWrapColumn": 132,
    "editor.wrappingIndent": "deepIndent",
    "files.autoSave": "afterDelay",
    "files.exclude": {
    "git.autofetch": true,
    "git.confirmSync": false,
    "git.enableCommitSigning": true,
    "go.autocompleteUnimportedPackages": true,
    "go.formatTool": "goimports",
    "go.gocodeAutoBuild": true,
    "go.liveErrors": {
    "go.vetOnSave": "workspace",
    "python.jediEnabled": false,
    "python.linting.pep8Enabled": true,
    "python.testing.unittestEnabled": true,
    "python.venvPath": "~/develop/virtualenv",
    "search.quickOpen.includeSymbols": true,
    "telemetry.enableTelemetry": false,
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "window.openFilesInNewWindow": "on",
    "window.zoomLevel": 0,
    "workbench.colorTheme": "Default Light+",
    "workbench.sideBar.location": "left",
    //"editor.wordWrap": "bounded",
    },
{
}
}{

0 个答案:

没有答案