Skip to content

Commit 9cebed1

Browse files
Null reference types (OmniSharp#330)
Enabled nullable reference types and added nullable annotations
1 parent 422460b commit 9cebed1

File tree

543 files changed

+2802
-2911
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

543 files changed

+2802
-2911
lines changed

.editorconfig

Lines changed: 89 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
root=true
1+
root=true
22
[*]
33
charset=utf-8
44
indent_style=space
@@ -8,58 +8,56 @@ insert_final_newline=true
88
max_line_length=180
99
end_of_line=crlf
1010

11-
[*.{cs,cshtml}]
12-
charset=utf-8
13-
indent_style=space
14-
indent_size=4
15-
insert_final_newline=true
16-
17-
[*.{js,ts,vue}]
18-
indent_style=space
19-
indent_size=4
20-
insert_final_newline=true
21-
22-
[*.{xml,yml,yaml}]
23-
indent_style=space
24-
indent_size=2
25-
insert_final_newline=true
26-
27-
[*.json]
28-
indent_style=space
29-
indent_size=4
30-
insert_final_newline=true
31-
32-
[*.{xml,csproj,props,targets}]
33-
indent_style=space
34-
35-
[{*.har,*.inputactions,*.jsb2,*.jsb3,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,jest.config}]
36-
indent_style=space
37-
indent_size=2
38-
39-
[*.{appxmanifest,asax,ascx,aspx,build,cg,cginc,compute,cs,cshtml,dtd,fs,fsi,fsscript,fsx,hlsl,hlsli,hlslinc,master,ml,mli,nuspec,razor,resw,resx,shader,skin,usf,ush,vb,xaml,xamlx,xoml,xsd}]
40-
indent_style=space
41-
indent_size=4
42-
tab_width=4
43-
4411
# Microsoft .NET properties
4512
csharp_new_line_before_members_in_object_initializers=false
13+
csharp_new_line_before_open_brace=types,methods,properties,indexers,events,event_accessors,control_blocks,anonymous_types,object_collections,array_initializers,local_functions
4614
csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
4715
csharp_space_between_parentheses=expressions
48-
csharp_style_var_elsewhere=true:suggestion
49-
csharp_style_var_for_built_in_types=true:suggestion
50-
csharp_style_var_when_type_is_apparent=true:suggestion
16+
csharp_style_expression_bodied_accessors=true:suggestion
17+
csharp_style_expression_bodied_constructors=true:none
18+
csharp_style_expression_bodied_indexers=true:none
19+
csharp_style_expression_bodied_methods=true:none
20+
csharp_style_expression_bodied_operators=true:none
21+
csharp_style_expression_bodied_properties=true:suggestion
22+
csharp_style_var_elsewhere=true:warning
23+
csharp_style_var_for_built_in_types=true:warning
24+
csharp_style_var_when_type_is_apparent=true:warning
5125
dotnet_style_parentheses_in_arithmetic_binary_operators=never_if_unnecessary:warning
5226
dotnet_style_parentheses_in_other_binary_operators=never_if_unnecessary:warning
5327
dotnet_style_parentheses_in_relational_binary_operators=never_if_unnecessary:warning
54-
dotnet_style_predefined_type_for_locals_parameters_members=true:suggestion
55-
dotnet_style_predefined_type_for_member_access=true:suggestion
56-
dotnet_style_qualification_for_event=false:suggestion
57-
dotnet_style_qualification_for_field=false:suggestion
58-
dotnet_style_qualification_for_method=false:suggestion
59-
dotnet_style_qualification_for_property=false:suggestion
28+
dotnet_style_predefined_type_for_locals_parameters_members=true:error
29+
dotnet_style_predefined_type_for_member_access=true:error
30+
dotnet_style_qualification_for_event=false:warning
31+
dotnet_style_qualification_for_field=false:warning
32+
dotnet_style_qualification_for_method=false:warning
33+
dotnet_style_qualification_for_property=false:warning
6034
dotnet_style_require_accessibility_modifiers=for_non_interface_members:suggestion
35+
# Sort using and Import directives with System.* appearing first
36+
dotnet_sort_system_directives_first=true
37+
# Suggest more modern language features when available
38+
dotnet_style_coalesce_expression=true:error
39+
dotnet_style_collection_initializer=true:suggestion
40+
dotnet_style_explicit_tuple_names=true:error
41+
dotnet_style_null_propagation=true:warning
42+
dotnet_style_object_initializer=true:warning
43+
44+
# Naming Conventions:
45+
# Pascal Casing
46+
#dotnet_naming_symbols.method_and_property_symbols.applicable_kinds= method,property,enum
47+
#dotnet_naming_symbols.method_and_property_symbols.applicable_accessibilities = *
48+
#dotnet_naming_style.pascal_case_style.capitalization = pascal_case
49+
csharp_style_conditional_delegate_call=true:suggestion
50+
csharp_style_inlined_variable_declaration=true:error
51+
csharp_style_pattern_matching_over_as_with_null_check=true:error
52+
csharp_style_pattern_matching_over_is_with_cast_check=true:error
53+
csharp_style_throw_expression=true:suggestion
54+
csharp_new_line_before_catch=true
55+
csharp_new_line_before_else=true
56+
csharp_new_line_before_finally=true
57+
csharp_new_line_before_members_in_anonymous_types=true
6158

6259
# ReSharper properties
60+
resharper_accessor_declaration_braces=end_of_line
6361
resharper_align_linq_query=true
6462
resharper_align_multiline_argument=true
6563
resharper_align_multiline_calls_chain=true
@@ -71,38 +69,46 @@ resharper_align_multline_type_parameter_constrains=true
7169
resharper_align_multline_type_parameter_list=true
7270
resharper_align_tuple_components=true
7371
resharper_autodetect_indent_settings=true
72+
resharper_constructor_or_destructor_body=expression_body
73+
resharper_csharp_anonymous_method_declaration_braces=end_of_line
7474
resharper_csharp_outdent_commas=true
7575
resharper_csharp_outdent_dots=true
76+
resharper_csharp_space_within_parentheses=true
7677
resharper_csharp_wrap_after_declaration_lpar=true
7778
resharper_csharp_wrap_after_invocation_lpar=true
7879
resharper_csharp_wrap_before_binary_opsign=true
7980
resharper_csharp_wrap_before_declaration_rpar=true
8081
resharper_csharp_wrap_before_invocation_rpar=true
82+
resharper_enforce_line_ending_style=true
83+
resharper_initializer_braces=end_of_line
8184
resharper_int_align_switch_expressions=true
8285
resharper_int_align_switch_sections=true
8386
resharper_keep_existing_enum_arrangement=true
8487
resharper_keep_existing_switch_expression_arrangement=false
8588
resharper_max_initializer_elements_on_line=2
89+
resharper_method_or_operator_body=expression_body
8690
resharper_outdent_binary_ops=true
8791
resharper_place_comments_at_first_column=true
8892
resharper_place_simple_enum_on_single_line=true
8993
resharper_space_around_arrow_op=true
9094
resharper_space_within_single_line_array_initializer_braces=true
95+
resharper_use_heuristics_for_body_style=false
9196
resharper_use_indent_from_vs=false
9297
resharper_wrap_lines=true
98+
resharper_xmldoc_allow_far_alignment=true
9399
resharper_xmldoc_attribute_style=on_single_line
100+
resharper_xmldoc_indent_text=ZeroIndent
101+
resharper_xmldoc_max_blank_lines_between_tags=1
94102
resharper_xmldoc_pi_attribute_style=on_single_line
95103
resharper_xmldoc_space_after_last_pi_attribute=true
96104

97105
# ReSharper inspection severities
98106
resharper_annotate_can_be_null_parameter_highlighting=warning
99107
resharper_annotate_can_be_null_type_member_highlighting=warning
100-
resharper_arrange_redundant_parentheses_highlighting=hint
101-
resharper_arrange_this_qualifier_highlighting=hint
102-
resharper_arrange_type_member_modifiers_highlighting=hint
103-
resharper_arrange_type_modifiers_highlighting=hint
104-
resharper_built_in_type_reference_style_for_member_access_highlighting=hint
105-
resharper_built_in_type_reference_style_highlighting=hint
108+
resharper_arrange_missing_parentheses_highlighting=warning
109+
resharper_arrange_this_qualifier_highlighting=warning
110+
resharper_built_in_type_reference_style_for_member_access_highlighting=error
111+
resharper_built_in_type_reference_style_highlighting=error
106112
resharper_enforce_do_while_statement_braces_highlighting=warning
107113
resharper_enforce_fixed_statement_braces_highlighting=warning
108114
resharper_enforce_foreach_statement_braces_highlighting=warning
@@ -111,59 +117,47 @@ resharper_enforce_if_statement_braces_highlighting=warning
111117
resharper_enforce_lock_statement_braces_highlighting=warning
112118
resharper_enforce_using_statement_braces_highlighting=warning
113119
resharper_enforce_while_statement_braces_highlighting=warning
114-
resharper_redundant_base_qualifier_highlighting=warning
115120
resharper_redundant_default_member_initializer_highlighting=hint
116121
resharper_remove_redundant_braces_highlighting=warning
117-
resharper_suggest_var_or_type_built_in_types_highlighting=hint
118-
resharper_suggest_var_or_type_elsewhere_highlighting=hint
119-
resharper_suggest_var_or_type_simple_types_highlighting=hint
122+
resharper_suggest_var_or_type_built_in_types_highlighting=warning
123+
resharper_suggest_var_or_type_elsewhere_highlighting=warning
124+
resharper_suggest_var_or_type_simple_types_highlighting=warning
120125
resharper_unnecessary_whitespace_highlighting=warning
121126
resharper_use_null_propagation_when_possible_highlighting=suggestion
122127
resharper_web_config_module_not_resolved_highlighting=warning
123128
resharper_web_config_type_not_resolved_highlighting=warning
124129
resharper_web_config_wrong_module_highlighting=warning
125130

126-
[*.{cs,vb}]
127-
# Sort using and Import directives with System.* appearing first
128-
dotnet_sort_system_directives_first=true
129-
# Avoid "this." and "Me." if not necessary
130-
dotnet_style_qualification_for_event=false:warning
131-
dotnet_style_qualification_for_field=false:warning
132-
dotnet_style_qualification_for_method=false:warning
133-
dotnet_style_qualification_for_property=false:warning
134-
# Use language keywords instead of framework type names for type references
135-
dotnet_style_predefined_type_for_locals_parameters_members=true:error
136-
dotnet_style_predefined_type_for_member_access=true:error
137-
# Suggest more modern language features when available
138-
dotnet_style_coalesce_expression=true:error
139-
dotnet_style_collection_initializer=true:suggestion
140-
dotnet_style_explicit_tuple_names=true:error
141-
dotnet_style_null_propagation=true:warning
142-
dotnet_style_object_initializer=true:warning
143131

144-
# Naming Conventions:
145-
# Pascal Casing
146-
#dotnet_naming_symbols.method_and_property_symbols.applicable_kinds= method,property,enum
147-
#dotnet_naming_symbols.method_and_property_symbols.applicable_accessibilities = *
148-
#dotnet_naming_style.pascal_case_style.capitalization = pascal_case
132+
[*.{cs,cshtml}]
133+
charset=utf-8
134+
indent_style=space
135+
indent_size=4
136+
insert_final_newline=true
149137

150-
[*.cs]
151-
csharp_style_conditional_delegate_call=true:suggestion
152-
csharp_style_expression_bodied_accessors=true:suggestion
153-
csharp_style_expression_bodied_constructors=true:none
154-
csharp_style_expression_bodied_indexers=true:none
155-
csharp_style_expression_bodied_methods=true:none
156-
csharp_style_expression_bodied_operators=true:none
157-
csharp_style_expression_bodied_properties=true:suggestion
158-
csharp_style_inlined_variable_declaration=true:error
159-
csharp_style_pattern_matching_over_as_with_null_check=true:error
160-
csharp_style_pattern_matching_over_is_with_cast_check=true:error
161-
csharp_style_throw_expression=true:suggestion
162-
csharp_style_var_elsewhere=true:warning
163-
csharp_style_var_for_built_in_types=true:warning
164-
csharp_style_var_when_type_is_apparent=true:error
165-
csharp_new_line_before_catch=true
166-
csharp_new_line_before_else=true
167-
csharp_new_line_before_finally=true
168-
csharp_new_line_before_members_in_anonymous_types=true
169-
csharp_new_line_before_open_brace=types,methods,properties,indexers,events,event_accessors,control_blocks,anonymous_types,object_collections,array_initializers,local_functions
138+
[*.{js,ts,vue}]
139+
indent_style=space
140+
indent_size=4
141+
insert_final_newline=true
142+
143+
[*.{xml,yml,yaml}]
144+
indent_style=space
145+
indent_size=2
146+
insert_final_newline=true
147+
148+
[*.json]
149+
indent_style=space
150+
indent_size=4
151+
insert_final_newline=true
152+
153+
[*.{xml,csproj,props,targets}]
154+
indent_style=space
155+
156+
[{*.har,*.inputactions,*.jsb2,*.jsb3,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,jest.config}]
157+
indent_style=space
158+
indent_size=2
159+
160+
[*.{appxmanifest,asax,ascx,aspx,build,cg,cginc,compute,cs,cshtml,dtd,fs,fsi,fsscript,fsx,hlsl,hlsli,hlslinc,master,ml,mli,nuspec,razor,resw,resx,shader,skin,usf,ush,vb,xaml,xamlx,xoml,xsd}]
161+
indent_style=space
162+
indent_size=4
163+
tab_width=4

sample/SampleServer/DidChangeWatchedFilesHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ namespace SampleServer
99
{
1010
internal class DidChangeWatchedFilesHandler : IDidChangeWatchedFilesHandler
1111
{
12-
private DidChangeWatchedFilesCapability _capability;
13-
1412
public DidChangeWatchedFilesRegistrationOptions GetRegistrationOptions() => new DidChangeWatchedFilesRegistrationOptions();
1513

1614
public Task<Unit> Handle(DidChangeWatchedFilesParams request, CancellationToken cancellationToken) => Unit.Task;
1715

18-
public void SetCapability(DidChangeWatchedFilesCapability capability) => _capability = capability;
16+
public void SetCapability(DidChangeWatchedFilesCapability capability)
17+
{
18+
}
1919
}
2020
}

sample/SampleServer/FoldingRangeHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ namespace SampleServer
88
{
99
internal class FoldingRangeHandler : IFoldingRangeHandler
1010
{
11-
private FoldingRangeCapability _capability;
12-
1311
public FoldingRangeRegistrationOptions GetRegistrationOptions() =>
1412
new FoldingRangeRegistrationOptions {
1513
DocumentSelector = DocumentSelector.ForLanguage("csharp")
@@ -31,6 +29,8 @@ CancellationToken cancellationToken
3129
)
3230
);
3331

34-
public void SetCapability(FoldingRangeCapability capability) => _capability = capability;
32+
public void SetCapability(FoldingRangeCapability capability)
33+
{
34+
}
3535
}
3636
}

0 commit comments

Comments
 (0)