简体   繁体   中英

Visual studio 2017, resharper - broken indentation

For whatever reason the line indentation broke for Visual Studio for me, but only for .NET Core projects (any other projects have correct setup). No matter what I put in the settings its always 2 spaces even though scaffolded components still get generated with 4.

Which ends up with:

public SomeClass 
{
public Guid Id { get; set; }
}

I also tried changing it in resharper but it also doesn't seem to work.

转载器窗口

This is literally driving me nuts. Anyone else had this?

If you encounter this issue, in my case it was .editorconfig file that had settings, which were overriding the configuration of both visual studio, and resharper. The file can be localized either in your solution folder, or more often in the folder which contains your package.json if you're using any framework like angular for your frontend.

# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false

This has already been reported to Microsoft by other developers but they don't consider it a bug.

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