From 4837e485a9f89308d6a69e2587f11827c018c265 Mon Sep 17 00:00:00 2001 From: Evgeniy S Date: Fri, 10 Jun 2022 07:29:55 +0300 Subject: [PATCH] Issue #219 Add configs for build and run from vscode --- .editorconfig | 126 +++++++++++++++++++++++++++++++++++++++- .vscode/extensions.json | 8 +++ .vscode/launch.json | 21 +++++++ .vscode/tasks.json | 13 +++++ 4 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.editorconfig b/.editorconfig index 5538a2b..bbfd0ca 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,17 +1,139 @@ ; Top-most http://editorconfig.org/ file root = true +charset=utf-8 ; Unix-style newlines [*] end_of_line = LF insert_final_newline = true +trim_trailing_whitespace = true -; 4-column tab indentation +; 4-column tab indentation and .NET coding conventions [*.cs] indent_style = tab indent_size = 4 +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = true + +csharp_style_var_elsewhere = true:suggestion +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion + +csharp_prefer_braces = when_multiline:suggestion +csharp_using_directive_placement = outside_namespace:suggestion +csharp_new_line_before_open_brace = all +csharp_space_around_binary_operators = before_and_after + +## Naming styles: + +dotnet_naming_style.camel_case.capitalization = camel_case +dotnet_naming_style.pascal_case.capitalization = pascal_case + +## Symbol specifications: + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal + +dotnet_naming_symbols.const_private_field.applicable_kinds = field +dotnet_naming_symbols.const_private_field.required_modifiers = const +dotnet_naming_symbols.const_private_field.applicable_accessibilities = private + +dotnet_naming_symbols.internal_field.applicable_kinds = field +dotnet_naming_symbols.internal_field.applicable_accessibilities = internal + +dotnet_naming_symbols.static_private_or_internal_field.required_modifiers = static +dotnet_naming_symbols.static_private_or_internal_field.applicable_accessibilities = internal, private + +dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private + +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal + +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 + +dotnet_naming_symbols.parameters.applicable_kinds = parameter + +## Naming rules: + +# IDE1006, IDE-only counterpart of StyleCopAnalyzers - SA1300: ElementMustBeginWithUpperCaseLetter. +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning +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 + +# IDE1006, IDE-only counterpart of StyleCopAnalyzers - SA1311: StaticReadonlyFieldsMustBeginWithUpperCaseLetter (silenced in OpenRA.ruleset). +dotnet_naming_rule.static_private_or_internal_field_should_be_pascal_case.severity = none +dotnet_naming_rule.static_private_or_internal_field_should_be_pascal_case.symbols = static_private_or_internal_field +dotnet_naming_rule.static_private_or_internal_field_should_be_pascal_case.style = pascal_case + +# IDE1006, IDE-only counterpart of StyleCopAnalyzers - SA1303: ConstFieldNamesMustBeginWithUpperCaseLetter. +dotnet_naming_rule.const_private_field_should_be_pascal_case.severity = warning +dotnet_naming_rule.const_private_field_should_be_pascal_case.symbols = const_private_field +dotnet_naming_rule.const_private_field_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.const_private_or_internal_field_should_be_pascal_case.severity = warning +dotnet_naming_rule.const_private_or_internal_field_should_be_pascal_case.symbols = internal_field +dotnet_naming_rule.const_private_or_internal_field_should_be_pascal_case.style = pascal_case + +# IDE1006, IDE-only counterpart of StyleCopAnalyzers - SA1306: FieldNamesMustBeginWithLowerCaseLetter. +dotnet_naming_rule.private_or_internal_field_should_be_camel_case.severity = warning +dotnet_naming_rule.private_or_internal_field_should_be_camel_case.symbols = private_or_internal_field +dotnet_naming_rule.private_or_internal_field_should_be_camel_case.style = camel_case + +# IDE1006, IDE-only counterpart of StyleCopAnalyzers - SA1313: ParameterNamesMustBeginWithLowerCaseLetter. +dotnet_naming_rule.parameters.severity = warning +dotnet_naming_rule.parameters.symbols = parameters +dotnet_naming_rule.parameters.style = camel_case + +## Formatting: + +# Also handled by StyleCopAnalyzers - SA1024: ColonsMustBeSpacedCorrectly. +csharp_space_after_colon_in_inheritance_clause = true + +# Also handled by StyleCopAnalyzers - SA1024: ColonsMustBeSpacedCorrectly. +csharp_space_before_colon_in_inheritance_clause = true + +# Also handled by StyleCopAnalyzers - SA1000: KeywordsMustBeSpacedCorrectly. +csharp_space_after_keywords_in_control_flow_statements = true + +# Leave code block on single line. +csharp_preserve_single_line_blocks = true + +# Leave statements and member declarations on the same line. +csharp_preserve_single_line_statements = true + +# IDE0049, IDE-only counterpart of StyleCopAnalyzers - SA1121: UseBuiltInTypeAlias. +dotnet_style_predefined_type_for_member_access = true + +# IDE0049, IDE-only counterpart of StyleCopAnalyzers - SA1121: UseBuiltInTypeAlias. +dotnet_style_predefined_type_for_locals_parameters_members = true + +## Others: + +# Show an IDE warning when default access modifiers are explicitly specified. +dotnet_style_require_accessibility_modifiers = omit_if_default:warning + +# Don't prefer braces (for one liners). +dotnet_diagnostic.IDE0011.severity = silent + +# Object initialization can be simplified / Use object initializer. +dotnet_diagnostic.IDE0017.severity = warning + +# Modifiers are not ordered. +dotnet_diagnostic.IDE0036.severity = warning + +# Raise a warning on build when default access modifiers are explicitly specified. +dotnet_diagnostic.IDE0040.severity = warning + +# Make field readonly. +dotnet_diagnostic.IDE0044.severity = warning + +# Avoid unnecessary zero-length array allocations. +dotnet_diagnostic.CA1825.severity = warning + ; 4-column tab indentation [*.yaml] indent_style = tab -indent_size = 4 \ No newline at end of file +indent_size = 4 diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..6b8c750 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "EditorConfig.EditorConfig", + "ms-dotnettools.csharp", + "openra.vscode-openra-lua", + "openra.oraide-vscode", + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..dd3134a --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "d2", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceRoot}/engine/bin/OpenRA.dll", + "windows": { + "program": "${workspaceRoot}/engine/bin/OpenRA.exe", + }, + "args": [ + "Engine.EngineDir=${workspaceRoot}/engine", + "Engine.ModSearchPaths=${workspaceRoot}/mods", + "Game.Mod=d2", + "Debug.DisplayDeveloperSettings=true", + ] + }, + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..fc48764 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,13 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "make", + "args": ["all"], + "windows": { + "command": "make.cmd" + } + } + ] +}