简体   繁体   中英

How do I setup JSON Text Editor Tabs/Spaces settings in Visual Studio Pro 2019?

I remember in previous versions of VS Pro that I used there used to be a configuration in: Options -> Text Editor -> JSON -> Tabs to specify what indentation I need for JSON files. I am currently using VS 2019 and I don't see an item for JSON under Text Editor . Did the procedure for setting up JSON indentation change? Am I looking in the wrong place? Did I forget to install something?

Create a .editorconfig file in the base of your project and enable overriding of config in VS settings:

root = true

[*]
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space

[*.cs]
indent_size = 4

[*.{ps1,xml,json}]
indent_size = 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM