Skip to content

Conversation

@softworkz
Copy link
Collaborator

None of these rules are needed for Visual Studio and these also do not stem from any defaults/templates of VS.

Resubmission of #433

softworkz and others added 2 commits August 29, 2024 09:59
None of these rules are needed for Visual Studio and these also do not stem from any defaults/templates of VS.
[*.{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.

[*.{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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants