gea*_*ear 3 visual-studio-code
当我在 Visual Studio Code 中保存 json 文件后,它会自动格式化文档,数组会垂直显示(通过添加换行符)。由于我有巨大的整数数组,因此几乎不可能快速查看文件。例子:
{
"big_integer_array": [
12,
15,
13,
1,
5,
8,
15,
14,
12,
...
],
"this_value_is_in_line_million": true
}
Run Code Online (Sandbox Code Playgroud)
我如何告诉程序,像这样水平显示数字数组:
{
"big_integer_array": [12,15,13,1,5,8,15,14,12, ...],
"this_value_is_in_line_three": true
}
Run Code Online (Sandbox Code Playgroud)
vscode v1.70 内置了一个专门针对这种情况的新设置:
JSON > Format: Keep Lines <= enable this in your Settings
"json.format.keepLines": true <= or use that setting in your settings.json
Run Code Online (Sandbox Code Playgroud)
此功能允许在 JSON 文档的行格式化时保留初始行位置。例如,在一行上包含值的数组在格式化后仍将在同一行上包含这些值。
JSON > Format: Keep Lines要启用此功能,请在设置中启用该选项。
使用 Insiders Build 进行演示 - 首先不启用设置,然后启用设置后:
| 归档时间: |
|
| 查看次数: |
4715 次 |
| 最近记录: |