Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editorconfig: Remove unnecessary rules #436

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ root = true
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = crlf
trim_trailing_whitespace = true
insert_final_newline = true
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
Expand All @@ -20,24 +17,13 @@ csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_indent_labels = one_less_than_current

[*.sln]
indent_style = tab

# Xml project files
[*.{config,csproj,njsproj,targets,vcxitems,vcxproj,vcxproj.filters}]
indent_size = 2
end_of_line = crlf
insert_final_newline = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we should leave insert_final_newline = false in. These are specific VS formats. VS never adds final new lines and removes them when found. It is safe and reasonable to leave this setting in the editorconfig, so other code editors won't accidentially insert final new lines when it is their default.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VS never adds final new lines and removes them when found

I don't see VS removing final new lines.

It is safe and reasonable to leave this setting in the editorconfig, so other code editors won't accidentially insert final new lines when it is their default

The right way to achieve this would be

insert_final_newline = unset

The problem with insert_final_newline is that some editors interpret it as instruction to remove a final newline. Setting it to false sounds like telling the editor to do nothing, but that's not always the result you get. The right way to have an editor do nothing wrt some rule is its absense. This is what unset achieves.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VS never adds final new lines and removes them when found

I don't see VS removing final new lines.

I guess what you mean is when making changes in the project designer in old-style (non-SDK) project, where the project desginer writes it out like this.
When you edit a csproj file for text editing (which is the same as what people with other editors would be doing), VS doesn't remove final line breaks.
For SDK style projects, it doesn't even do this when making changes with the project designer.


# XML config files
[*.{msbuild,props,targets,ruleset,config,nuspec}]
indent_size = 2
end_of_line = crlf
insert_final_newline = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we should leave insert_final_newline = false in. These are specific VS formats. VS never adds final new lines and removes them when found. It is safe and reasonable to leave this setting in the editorconfig, so other code editors won't accidentially insert final new lines when it is their default.


# Windows Shell scripts
[*.{cmd,bat,ps1}]
end_of_line = crlf

[*.{cs,vb}]
#### Naming styles ####
Expand Down
Loading