microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.99k stars 29.19k forks source link

Default JSON formatter puts opening object bracket on same line as parent array bracket #201104

Closed tinder-tannerbennett closed 10 months ago

tinder-tannerbennett commented 10 months ago

Type: Bug

Screenshot 2023-12-18 at 12 42 10 AM

Surely this is not the desired behavior. And if it is, there appears to be no way to change it?

VS Code version: Code 1.84.2 (Universal) (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:52:33.687Z) OS version: Darwin arm64 22.6.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 Max (10 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|14, 20, 15| |Memory (System)|64.00GB (13.89GB free)| |Process Argv|--crash-reporter-id 00e4d846-4b43-4a04-bc40-e8f2034b7ee0| |Screen Reader|no| |VM|0%|
Extensions (69) Extension|Author (truncated)|Version ---|---|--- makefiles-runner|ake|1.1.2 Bookmarks|ale|13.4.2 cucumberautocomplete|ale|2.15.2 tsl-problem-matcher|amo|0.6.2 npm-intellisense|chr|1.4.5 arm|dan|1.7.4 mustache|daw|1.1.1 vscode-eslint|dba|2.4.2 vscode-html-css|ecm|1.13.1 insert-random-text|Ele|0.1.3 vscode-mysql|for|0.5.0 copilot|Git|1.143.0 copilot-chat|Git|0.10.2 vscode-graphql-syntax|Gra|1.2.2 triggertaskonsave|Gru|0.2.17 generate-switch-case-for-enum-type|her|0.0.10 reg|ion|1.1.0 latex-workshop|Jam|9.15.8 mediawiki|jas|0.0.4 vscode-gnupg-tool|JHe|1.4.1 vscode-graphviz|joa|0.0.9 json-escaper|jos|1.1.2 favorites|kdc|2.4.5 vscode-sshfs|Kel|1.26.1 vscode-phpfmt|kok|1.1.35 vscode-JS-CSS-HTML-formatter|lon|0.2.3 syntax-project-pbxproj|mar|0.1.3 vscode-autohotkey-plus-plus|mar|5.0.3 xcodestrings|mhc|1.0.0 git-graph|mhu|1.30.0 fluent-icons|mig|0.0.18 vscode-nbt|Mis|0.9.1 vscode-clang|mit|0.2.4 graphql|mqu|0.1.2 isort|ms-|2023.10.1 python|ms-|2023.22.1 vscode-pylance|ms-|2023.12.1 jupyter|ms-|2023.10.1100000000 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.17 vscode-jupyter-cell-tags|ms-|0.1.8 vscode-jupyter-slideshow|ms-|0.1.5 remote-containers|ms-|0.327.0 remote-ssh|ms-|0.107.1 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.81.8 vscode-remote-extensionpack|ms-|0.25.0 remote-explorer|ms-|0.4.1 remote-server|ms-|1.5.0 wordcount|ms-|0.1.0 objective-clean|obj|2.0.0 psi-header|psi|1.22.2 vscode-commons|red|0.0.6 vscode-yaml|red|1.14.0 vscode-paste-and-indent|Rub|0.0.8 vscode-fileutils|sle|3.10.3 swift-lang|ssw|1.7.1 dot|Ste|0.0.1 addDocComments|ste|0.0.8 stencil|sva|1.0.1 tinder-studio|Tan|0.0.1 vscode-pets|ton|1.25.1 vscode-counter|uct|3.3.0 vscode-lldb|vad|1.10.0 vscode-swiftformat|vkn|1.6.7 gitblame|wad|10.6.0 clang-format|xav|1.9.0 propertylist|zho|0.0.2 vitest-explorer|Zix|0.2.43 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscoreces:30445986 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 pythonvs932:30410667 py29gd2263:30899288 vsclangdc:30486549 c4g48928:30535728 dsvsc012cf:30540253 azure-dev_surveyone:30548225 282f8724:30602487 89544117:30613380 2i9eh265:30646982 showlangstatbar:30737416 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 welcomedialogc:30910334 pythonnosmt12:30797651 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 dsvsc013:30795093 dsvsc014:30804076 dsvsc015:30845448 pythontestfixt:30902429 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 accentitlementst:30887150 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 aa_t_chat:30882232 dsvsc019cf:30917260 cp7184c:30925681 ```
vscodenpa commented 10 months ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.85.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

aeschli commented 10 months ago

When I format

{
    "views": {
        "tinder-studio": [{
            "id": "hello"
        }

    ]
    }
}

I get

{
    "views": {
        "tinder-studio": [
            {
                "id": "hello"
            }
        ]
    }
}

Please share the example code.

tinder-tannerbennett commented 10 months ago

Looks like it was another formatting extension getting in the way. I didn't know it was formatting the document because it doesn't refer to "JSON" in the extension's name.

Sorry, I'll close this ;(