dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.89k stars 4.01k forks source link

Every time I open the .editorconfig it adds things to the file I don't want #59325

Open vsfeedback opened 2 years ago

vsfeedback commented 2 years ago

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version] So I'm working on switching our project from using Rulesets to using .editorconfig. Right now every time I the .editorconfig it adds a whole bunch of options to them such as dictating line endings.

I don't want to dictate line endings on dev machines in this project. But no matter what I do every single time I open this file in the default UI. It appends things.

Specifically it adds the following

csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion

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

# Naming rules

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers = 

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers = 

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers = 

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix = 
dotnet_naming_style.begins_with_i.word_separator = 
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix = 
dotnet_naming_style.pascal_case.required_suffix = 
dotnet_naming_style.pascal_case.word_separator = 
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix = 
dotnet_naming_style.pascal_case.required_suffix = 
dotnet_naming_style.pascal_case.word_separator = 
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion

So not only do I need to use a different editor to use this file. Everyone who accidentally opens it will have this issue.. Its just terrible

Just opening a file should NEVER edit it.


Original Comments

Feedback Bot on 2/2/2022, 10:42 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 2/4/2022, 00:09 PM:

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.


Original Solutions

(no solutions)

Youssef1313 commented 2 years ago

@jmarolf Did you mean to move it to dotnet/roslyn? This looks unrelated to roslyn-analyzers

jmarolf commented 2 years ago

whoops, thanks @Youssef1313 the bot that moves these over picks a repo based on areas path and I forgot to change this to the roslyn one before moving it to github.

jmarolf commented 2 years ago

related to https://github.com/dotnet/roslyn/issues/52735

333fred commented 1 year ago

I hit this myself just now. I have an editorconfig where I've only specified 3 keys, related to tab and indent control for a specific folder, and every time I accidentally open the file in the editorconfig UI it adds a whole bunch of keys that I did not have set and don't want to be set. As much as I want to like the editorconfig UI, I find myself completely unable to trust it, given the issues around inserting unwanted things and not saving correctly (https://github.com/dotnet/roslyn/issues/54556 for that one).

majorregal commented 1 year ago

Yes for the love of god, please fix this. EditorConfig UI is unusable with this bug and simply dropping a .editorconfig file in the root solution/project directory (tried both) does nothing. It seems like Visual Studio only does something when "directed" through the EditorConfig UI.

alexdresko commented 1 year ago

There are SO many problems with the .editorconfig UI. I think I'm just going to avoid it and edit the file manually now that I've got it somewhere close to how I want it.

This comment in the docs blows my mind. You can't use the .editorconfig UI if you don't want it to use the : format.

image

ltlombardi commented 6 months ago

This ticket just turned 2 years old Happy Birthday 🍰🎂

VincentH-Net commented 5 months ago

In Visual Studio 17.9.5, after changing settings in the designer and saving, entries that are already in the [*.cs] section are added in either an additional [*.{cs,vb}] section or an existing section other than [*.cs].

The editor is both the default and unusable due to this behaviour.

wforney commented 3 months ago

Why do we need a GUI for this? Why don't you guys fix the intellisense for it so it actually shows the rules and ditch this crappy GUI that doesn't honor the groups and has all these issues? Who though it was a good idea to break the intellisense and add a crappy GUI?

wforney commented 3 months ago

In Visual Studio 17.9.5, after changing settings in the designer and saving, entries that are already in the [*.cs] section are added in either an additional [*.{cs,vb}] section or an existing section other than [*.cs].

The editor is both the default and unusable due to this behaviour.

You do know you can switch to the raw file with F7? But the intellisense was broken around the time they added the GUI, presumably to push people towards using it... though it is limited... I tried to use the GUI. It sucks. I just open the file, hit F7 and close the GUI and edit by hand without intellisense. Might as well be using notepad.