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

Add UI for editorconfig files #51069

Merged
25 commits merged into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
faf7c13
Add UI for editorconfig files
jmarolf Jan 6, 2021
bab8e5d
update settings helper values for IOption2 writer
jmarolf Mar 19, 2021
0cc4b9e
Update .gitignore
jmarolf Mar 18, 2021
c4ff7f3
Update src/EditorFeatures/Core/EditorConfigSettings/Extensions/Soluti…
jmarolf Mar 19, 2021
c1ec753
use WhereNotNull
jmarolf Mar 19, 2021
837c00f
simplify null checking of array
jmarolf Mar 19, 2021
b619aef
fix tab backgound color in some themes
jmarolf Mar 19, 2021
a13246a
rename CreateGridElemetn to CreateItemElement
jmarolf Mar 19, 2021
ec7740f
use common guid
jmarolf Mar 19, 2021
ed97136
remove incorrect comment
jmarolf Mar 22, 2021
759e0af
split types to separate files
jmarolf Mar 22, 2021
0e84436
xaml it up
jmarolf Mar 22, 2021
0d96fc1
set automation properties
jmarolf Mar 22, 2021
56d6ec2
tweaks to filerability
jmarolf Mar 24, 2021
22a61db
do not respond to workspace changed events instead let a new window b…
jmarolf Mar 24, 2021
289aa3c
do not allow the user to sort or filter mutable data
jmarolf Mar 24, 2021
b7c06a3
add data tests
jmarolf Mar 24, 2021
f8f2106
xaml fixes found in testing
jmarolf Mar 25, 2021
2976da0
remove async from data providers
jmarolf Mar 27, 2021
7e21933
simplify view
jmarolf Mar 28, 2021
e3df1f6
fix text header
jmarolf Mar 28, 2021
c8472e1
ensure that AnalyzerConfigOptionsResult is consulted
jmarolf Mar 28, 2021
0f65913
handle null case in tests
jmarolf Mar 29, 2021
d1af11b
simplify threading for updating code
jmarolf Mar 29, 2021
b21007b
simplfy updating threading model for editorconfig buffer
jmarolf Mar 29, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void Add(K key, V value)

private void MoveNodeToTop(LinkedListNode<K> node)
{
if (!object.ReferenceEquals(_nodeList.First, node))
if (!ReferenceEquals(_nodeList.First, node))
{
_nodeList.Remove(node);
_nodeList.AddFirst(node);
Expand Down
1 change: 1 addition & 0 deletions src/Compilers/Test/Core/Traits/Traits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public static class Features
public const string DocCommentFormatting = nameof(DocCommentFormatting);
public const string DocumentationComments = nameof(DocumentationComments);
public const string EditorConfig = nameof(EditorConfig);
public const string EditorConfigUI = nameof(EditorConfigUI);
public const string EncapsulateField = nameof(EncapsulateField);
public const string EndConstructGeneration = nameof(EndConstructGeneration);
public const string ErrorList = nameof(ErrorList);
Expand Down
255 changes: 255 additions & 0 deletions src/EditorFeatures/CSharp/CSharpEditorResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,259 @@
<value>Add Missing Usings on Paste</value>
<comment>"usings" is a language specific term and should not be localized</comment>
</data>
<data name="Avoid_expression_statements_that_implicitly_ignore_value" xml:space="preserve">
<value>Avoid expression statements that implicitly ignore value</value>
Copy link
Member

Choose a reason for hiding this comment

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

  1. did tehse values get moved from somewhere else? are they copies?
  2. isn't this a value that would be shared between C# and VB? why is it in CSharpEditorResources?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did tehse values get moved from somewhere else? are they copies?

These values are copied from a higher layer. There is no reason these types need to be in the VS layer instead of the Editor layer other than the resources but I can move the types back if we don't want to worry about it.

isn't this a value that would be shared between C# and VB? why is it in CSharpEditorResources?

CSharpCodeStyleOptions.UnusedValueExpressionStatement is a C# only option as far as I can tell. if we ever offer the ability to enforce this for VB then we should move it.

</data>
<data name="Avoid_unused_value_assignments" xml:space="preserve">
<value>Avoid unused value assignments</value>
</data>
<data name="Discard" xml:space="preserve">
<value>Discard</value>
</data>
<data name="Elsewhere" xml:space="preserve">
<value>Elsewhere</value>
</data>
<data name="For_built_in_types" xml:space="preserve">
<value>For built-in types</value>
</data>
<data name="Ignore_spaces_in_declaration_statements" xml:space="preserve">
<value>Ignore spaces in declaration statements</value>
</data>
<data name="Indent_block_contents" xml:space="preserve">
<value>Indent block contents</value>
</data>
<data name="Indent_case_contents" xml:space="preserve">
<value>Indent case contents</value>
</data>
<data name="Indent_case_contents_when_block" xml:space="preserve">
<value>Indent case contents (when block)</value>
</data>
<data name="Indent_case_labels" xml:space="preserve">
<value>Indent case labels</value>
</data>
<data name="Indent_open_and_close_braces" xml:space="preserve">
<value>Indent open and close braces</value>
</data>
<data name="Insert_spaces_within_parentheses_of_control_flow_statements" xml:space="preserve">
<value>Insert spaces within parentheses of control flow statements</value>
</data>
<data name="Insert_spaces_within_square_brackets" xml:space="preserve">
<value>Insert spaces within square brackets</value>
</data>
<data name="Insert_space_after_cast" xml:space="preserve">
<value>Insert space after cast</value>
</data>
<data name="Insert_space_after_colon_for_base_or_interface_in_type_declaration" xml:space="preserve">
<value>Insert space after colon for base or interface in type declaration</value>
</data>
<data name="Insert_space_after_comma" xml:space="preserve">
<value>Insert space after comma</value>
</data>
<data name="Insert_space_after_dot" xml:space="preserve">
<value>Insert space after dot</value>
</data>
<data name="Insert_space_after_keywords_in_control_flow_statements" xml:space="preserve">
<value>Insert space after keywords in control flow statements</value>
</data>
<data name="Insert_space_after_semicolon_in_for_statement" xml:space="preserve">
<value>Insert space after semicolon in "for" statement</value>
</data>
<data name="Insert_space_before_colon_for_base_or_interface_in_type_declaration" xml:space="preserve">
<value>Insert space before colon for base or interface in type declaration</value>
</data>
<data name="Insert_space_before_comma" xml:space="preserve">
<value>Insert space before comma</value>
</data>
<data name="Insert_space_before_dot" xml:space="preserve">
<value>Insert space before dot</value>
</data>
<data name="Insert_space_before_open_square_bracket" xml:space="preserve">
<value>Insert space before open square bracket</value>
</data>
<data name="Insert_space_before_semicolon_in_for_statement" xml:space="preserve">
<value>Insert space before semicolon in "for" statement</value>
</data>
<data name="Insert_space_between_method_name_and_its_opening_parenthesis1" xml:space="preserve">
<value>Insert space between method name and its opening parenthesis</value>
</data>
<data name="Insert_space_between_method_name_and_its_opening_parenthesis2" xml:space="preserve">
<value>Insert space between method name and its opening parenthesis</value>
</data>
<data name="Insert_space_within_argument_list_parentheses" xml:space="preserve">
<value>Insert space within argument list parentheses</value>
</data>
<data name="Insert_space_within_empty_argument_list_parentheses" xml:space="preserve">
<value>Insert space within empty argument list parentheses</value>
</data>
<data name="Insert_space_within_empty_parameter_list_parentheses" xml:space="preserve">
<value>Insert space within empty parameter list parentheses</value>
</data>
<data name="Insert_space_within_empty_square_brackets" xml:space="preserve">
<value>Insert space within empty square brackets</value>
</data>
<data name="Insert_space_within_parameter_list_parentheses" xml:space="preserve">
<value>Insert space within parameter list parentheses</value>
</data>
<data name="Insert_space_within_parentheses_of_expressions" xml:space="preserve">
<value>Insert space within parentheses of expressions</value>
</data>
<data name="Insert_space_within_parentheses_of_type_casts" xml:space="preserve">
<value>Insert space within parentheses of type casts</value>
</data>
<data name="Inside_namespace" xml:space="preserve">
<value>Inside namespace</value>
</data>
<data name="Label_Indentation" xml:space="preserve">
<value>Label Indentation</value>
</data>
<data name="Leave_block_on_single_line" xml:space="preserve">
<value>Leave block on single line</value>
</data>
<data name="Leave_statements_and_member_declarations_on_the_same_line" xml:space="preserve">
<value>Leave statements and member declarations on the same line</value>
</data>
<data name="Never" xml:space="preserve">
<value>Never</value>
</data>
<data name="Place_catch_on_new_line" xml:space="preserve">
<value>Place "catch" on new line</value>
</data>
<data name="Place_else_on_new_line" xml:space="preserve">
<value>Place "else" on new line</value>
</data>
<data name="Place_finally_on_new_line" xml:space="preserve">
<value>Place "finally" on new line</value>
</data>
<data name="Place_members_in_anonymous_types_on_new_line" xml:space="preserve">
<value>Place members in anonymous types on new line</value>
</data>
<data name="Place_members_in_object_initializers_on_new_line" xml:space="preserve">
<value>Place members in object initializers on new line</value>
</data>
<data name="Place_open_brace_on_new_line_for_anonymous_methods" xml:space="preserve">
<value>Place open brace on new line for anonymous methods</value>
</data>
<data name="Place_open_brace_on_new_line_for_anonymous_types" xml:space="preserve">
<value>Place open brace on new line for anonymous types</value>
</data>
<data name="Place_open_brace_on_new_line_for_control_blocks" xml:space="preserve">
<value>Place open brace on new line for control blocks</value>
</data>
<data name="Place_open_brace_on_new_line_for_lambda_expression" xml:space="preserve">
<value>Place open brace on new line for lambda expression</value>
</data>
<data name="Place_open_brace_on_new_line_for_methods_local_functions" xml:space="preserve">
<value>Place open brace on new line for methods and local functions</value>
</data>
<data name="Place_open_brace_on_new_line_for_object_collection_array_and_with_initializers" xml:space="preserve">
<value>Place open brace on new line for object, collection, array, and with initializers</value>
</data>
<data name="Place_open_brace_on_new_line_for_properties_indexers_and_events" xml:space="preserve">
<value>Place open brace on new line for properties, indexers, and events</value>
</data>
<data name="Place_open_brace_on_new_line_for_property_indexer_and_event_accessors" xml:space="preserve">
<value>Place open brace on new line for property, indexer, and event accessors</value>
</data>
<data name="Place_open_brace_on_new_line_for_types" xml:space="preserve">
<value>Place open brace on new line for types</value>
</data>
<data name="Place_query_expression_clauses_on_new_line" xml:space="preserve">
<value>Place query expression clauses on new line</value>
</data>
<data name="Preferred_using_directive_placement" xml:space="preserve">
<value>Preferred 'using' directive placement</value>
</data>
<data name="Prefer_conditional_delegate_call" xml:space="preserve">
<value>Prefer conditional delegate call</value>
</data>
<data name="Prefer_deconstructed_variable_declaration" xml:space="preserve">
<value>Prefer deconstructed variable declaration</value>
</data>
<data name="Prefer_explicit_type" xml:space="preserve">
<value>Prefer explicit type</value>
</data>
<data name="Prefer_index_operator" xml:space="preserve">
<value>Prefer index operator</value>
</data>
<data name="Prefer_inlined_variable_declaration" xml:space="preserve">
<value>Prefer inlined variable declaration</value>
</data>
<data name="Prefer_local_function_over_anonymous_function" xml:space="preserve">
<value>Prefer local function over anonymous function</value>
</data>
<data name="Prefer_pattern_matching" xml:space="preserve">
<value>Prefer pattern matching</value>
</data>
<data name="Prefer_pattern_matching_over_as_with_null_check" xml:space="preserve">
<value>Prefer pattern matching over 'as' with 'null' check</value>
</data>
<data name="Prefer_pattern_matching_over_is_with_cast_check" xml:space="preserve">
<value>Prefer pattern matching over 'is' with 'cast' check</value>
</data>
<data name="Prefer_pattern_matching_over_mixed_type_check" xml:space="preserve">
<value>Prefer pattern matching over mixed type check</value>
</data>
<data name="Prefer_range_operator" xml:space="preserve">
<value>Prefer range operator</value>
</data>
<data name="Prefer_simple_default_expression" xml:space="preserve">
<value>Prefer simple 'default' expression</value>
</data>
<data name="Prefer_simple_using_statement" xml:space="preserve">
<value>Prefer simple 'using' statement</value>
</data>
<data name="Prefer_static_local_functions" xml:space="preserve">
<value>Prefer static local functions</value>
</data>
<data name="Prefer_switch_expression" xml:space="preserve">
<value>Prefer switch expression</value>
</data>
<data name="Prefer_throw_expression" xml:space="preserve">
<value>Prefer throw-expression</value>
</data>
<data name="Prefer_var" xml:space="preserve">
<value>Prefer 'var'</value>
</data>
<data name="Set_spacing_for_operators" xml:space="preserve">
<value>Set spacing for operators</value>
</data>
<data name="Unused_local" xml:space="preserve">
<value>Unused local</value>
</data>
<data name="Use_expression_body_for_accessors" xml:space="preserve">
<value>Use expression body for accessors</value>
</data>
<data name="Use_expression_body_for_constructors" xml:space="preserve">
<value>Use expression body for constructors</value>
</data>
<data name="Use_expression_body_for_indexers" xml:space="preserve">
<value>Use expression body for indexers</value>
</data>
<data name="Use_expression_body_for_lambdas" xml:space="preserve">
<value>Use expression body for lambdas</value>
</data>
<data name="Use_expression_body_for_local_functions" xml:space="preserve">
<value>Use expression body for local functions</value>
</data>
<data name="Use_expression_body_for_methods" xml:space="preserve">
<value>Use expression body for methods</value>
</data>
<data name="Use_expression_body_for_operators" xml:space="preserve">
<value>Use expression body for operators</value>
</data>
<data name="Use_expression_body_for_properties" xml:space="preserve">
<value>Use expression body for properties</value>
</data>
<data name="When_on_single_line" xml:space="preserve">
<value>When on single line</value>
</data>
<data name="When_possible" xml:space="preserve">
<value>When possible</value>
</data>
<data name="When_variable_type_is_apparent" xml:space="preserve">
<value>When variable type is apparent</value>
</data>
<data name="Outside_namespace" xml:space="preserve">
<value>Outside namespace</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Composition;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor.EditorConfigSettings.Data;
using Microsoft.CodeAnalysis.Editor.EditorConfigSettings.DataProvider;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;

namespace Microsoft.VisualStudio.LanguageServices.CSharp.EditorConfigSettings.DataProvider.CodeStyle
{
[ExportLanguageServiceFactory(typeof(ILanguageSettingsProviderFactory<CodeStyleSetting>), LanguageNames.CSharp), Shared]
internal class CSharpCodeStyleSettingsLanguageServiceFactory : ILanguageServiceFactory
Copy link
Member

Choose a reason for hiding this comment

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

so this is like a factory factory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't wnat to write that but...

{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpCodeStyleSettingsLanguageServiceFactory()
{
}

public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
var workspace = languageServices.WorkspaceServices.Workspace;
return new CSharpCodeStyleSettingsProviderFactory(workspace);
}
}
}
Loading