小编Art*_*ave的帖子

vscode json 格式化程序:不包装 json 对象

我现在正在使用 avro .avsc 模式,我喜欢在示例中进行格式化:

{
 "namespace": "example.avro",
 "type": "record",
 "name": "User",
 "fields": [
     {"name": "name", "type": "string"},
     {"name": "favorite_number",  "type": ["int", "null"]},
     {"name": "favorite_color", "type": ["string", "null"]}
 ]
}
Run Code Online (Sandbox Code Playgroud)

我特指的是单行字段定义{"name": "name", "type": "string"}

我想在 vscode 中编辑和格式化我的架构,但它不断包装字段,例如

 {
   "name": "name",
   "type": "string"
 }
Run Code Online (Sandbox Code Playgroud)

我尝试配置默认的 json 格式化程序并使用beautify扩展名setting.json,但没有成功

   "[json]": {
        "editor.tabSize": 2,
        "editor.wordWrap": "off",
        "editor.defaultFormatter": "vscode.json-language-features",
        // "editor.defaultFormatter": "HookyQR.beautify"
    },
    "html.format.wrapAttributes": "preserve",

    "beautify.config": {
        "indent_size": 2,
        "indent_char": " ",
        "preserve_newlines": true,
        "space_in_paren": true,
        "space_in_empty_paren": true,
        "wrap_attributes": "preserve", …
Run Code Online (Sandbox Code Playgroud)

formatting json visual-studio-code avsc

5
推荐指数
1
解决办法
2873
查看次数

标签 统计

avsc ×1

formatting ×1

json ×1

visual-studio-code ×1