未验证 提交 fcb3004d 编写于 作者: J Joey Robichaud 提交者: GitHub

Add import placement codestyle, diagnostic, and fixer (#35009)

* Add import placement codestyle option

* Add TextEditor CodeStyle options for Using Placement

* Add misplaced using directives analyzer and code fix

* Use consistent pluralization

* Removed Preserve AddImportPlacement option

* Removed Preserve from CSharp Style Options

* Removed Preserve from editorconfig tests

* Coverted to Roslyn style analyzer and fixer tests.

* Simplified MisplacedUsings CodeFix based on feedback.

* Simplified MisplacedUsings CodeFix based on feedback.

* Add warning annotation to moved using directives

* Move misplaced usings out of multiple namespaces

* Deduplicate usings when moving them

* Simplified move usings warning text

* Add expected warning markers to misplaced using tests

* Fix editor config generator tests

* Consolidated diagnostics and tests

* Add tests where directives are in both contexts
上级 e50ad9d8
......@@ -78,6 +78,24 @@ internal class CSharpEditorResources {
}
}
/// <summary>
/// Looks up a localized string similar to Misplaced using directive.
/// </summary>
internal static string Misplaced_using_directive {
get {
return ResourceManager.GetString("Misplaced_using_directive", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Move misplaced using directives.
/// </summary>
internal static string Move_misplaced_using_directives {
get {
return ResourceManager.GetString("Move_misplaced_using_directives", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to (Press TAB to insert).
/// </summary>
......@@ -104,5 +122,32 @@ internal class CSharpEditorResources {
return ResourceManager.GetString("Split_string", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Using directives must be placed inside of a namespace declaration.
/// </summary>
internal static string Using_directives_must_be_placed_inside_of_a_namespace_declaration {
get {
return ResourceManager.GetString("Using_directives_must_be_placed_inside_of_a_namespace_declaration", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Using directives must be placed outside of a namespace declaration.
/// </summary>
internal static string Using_directives_must_be_placed_outside_of_a_namespace_declaration {
get {
return ResourceManager.GetString("Using_directives_must_be_placed_outside_of_a_namespace_declaration", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning: Moving using directives may change code meaning..
/// </summary>
internal static string Warning_colon_Moving_using_directives_may_change_code_meaning {
get {
return ResourceManager.GetString("Warning_colon_Moving_using_directives_may_change_code_meaning", resourceCulture);
}
}
}
}
......@@ -132,4 +132,24 @@
<data name="Split_string" xml:space="preserve">
<value>Split string</value>
</data>
<data name="Misplaced_using_directive" xml:space="preserve">
<value>Misplaced using directive</value>
<comment>{Locked="using"} "using" is a C# keyword and should not be localized.</comment>
</data>
<data name="Move_misplaced_using_directives" xml:space="preserve">
<value>Move misplaced using directives</value>
<comment>{Locked="using"} "using" is a C# keyword and should not be localized.</comment>
</data>
<data name="Using_directives_must_be_placed_inside_of_a_namespace_declaration" xml:space="preserve">
<value>Using directives must be placed inside of a namespace declaration</value>
<comment>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</comment>
</data>
<data name="Using_directives_must_be_placed_outside_of_a_namespace_declaration" xml:space="preserve">
<value>Using directives must be placed outside of a namespace declaration</value>
<comment>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</comment>
</data>
<data name="Warning_colon_Moving_using_directives_may_change_code_meaning" xml:space="preserve">
<value>Warning: Moving using directives may change code meaning.</value>
<comment>{Locked="using"} "using" is a C# keyword and should not be localized.</comment>
</data>
</root>
\ No newline at end of file
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.AddImports;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.CSharp;
namespace Microsoft.CodeAnalysis.CSharp.MisplacedUsingDirectives
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
internal sealed class MisplacedUsingDirectivesDiagnosticAnalyzer : AbstractCodeStyleDiagnosticAnalyzer
{
private static readonly LocalizableResourceString s_localizableTitle = new LocalizableResourceString(
nameof(CSharpEditorResources.Misplaced_using_directive), CSharpEditorResources.ResourceManager, typeof(CSharpEditorResources));
private static readonly LocalizableResourceString s_localizableOutsideMessage = new LocalizableResourceString(
nameof(CSharpEditorResources.Using_directives_must_be_placed_outside_of_a_namespace_declaration), CSharpEditorResources.ResourceManager, typeof(CSharpEditorResources));
private static readonly DiagnosticDescriptor s_outsideDiagnosticDescriptor = CreateDescriptorWithId(
IDEDiagnosticIds.MoveMisplacedUsingDirectivesDiagnosticId, s_localizableTitle, s_localizableOutsideMessage);
private static readonly LocalizableResourceString s_localizableInsideMessage = new LocalizableResourceString(
nameof(CSharpEditorResources.Using_directives_must_be_placed_inside_of_a_namespace_declaration), CSharpEditorResources.ResourceManager, typeof(CSharpEditorResources));
private static readonly DiagnosticDescriptor s_insideDiagnosticDescriptor = CreateDescriptorWithId(
IDEDiagnosticIds.MoveMisplacedUsingDirectivesDiagnosticId, s_localizableTitle, s_localizableInsideMessage);
public MisplacedUsingDirectivesDiagnosticAnalyzer()
: base(new[] { s_outsideDiagnosticDescriptor, s_insideDiagnosticDescriptor }.AsImmutable())
{
}
protected override void InitializeWorker(AnalysisContext context)
{
context.RegisterSyntaxNodeAction(AnalyzeNamespaceNode, SyntaxKind.NamespaceDeclaration);
context.RegisterSyntaxNodeAction(AnalyzeCompilationUnitNode, SyntaxKind.CompilationUnit);
}
private void AnalyzeNamespaceNode(SyntaxNodeAnalysisContext context)
{
var option = GetPreferredPlacementOptionAsync(context).GetAwaiter().GetResult();
if (option.Value != AddImportPlacement.OutsideNamespace)
{
return;
}
var namespaceDeclaration = (NamespaceDeclarationSyntax)context.Node;
ReportDiagnostics(context, s_outsideDiagnosticDescriptor, namespaceDeclaration.Usings, option);
}
private static void AnalyzeCompilationUnitNode(SyntaxNodeAnalysisContext context)
{
var option = GetPreferredPlacementOptionAsync(context).GetAwaiter().GetResult();
var compilationUnit = (CompilationUnitSyntax)context.Node;
if (option.Value != AddImportPlacement.InsideNamespace
|| ShouldSuppressDiagnostic(compilationUnit))
{
return;
}
// Note: We will report diagnostics when a code file contains multiple namespaces even though we will
// not offer a code fix in these cases.
ReportDiagnostics(context, s_insideDiagnosticDescriptor, compilationUnit.Usings, option);
}
private static bool ShouldSuppressDiagnostic(CompilationUnitSyntax compilationUnit)
{
// Suppress if there are nodes other than usings and namespaces in the
// compilation unit (including ExternAlias).
return compilationUnit.ChildNodes().Any(
t => !t.IsKind(SyntaxKind.UsingDirective, SyntaxKind.NamespaceDeclaration));
}
private static async Task<CodeStyleOption<AddImportPlacement>> GetPreferredPlacementOptionAsync(SyntaxNodeAnalysisContext context)
{
var options = await context.Options.GetDocumentOptionSetAsync(context.Node.SyntaxTree, context.CancellationToken);
return options.GetOption(CSharpCodeStyleOptions.PreferredUsingDirectivePlacement);
}
private static void ReportDiagnostics(
SyntaxNodeAnalysisContext context, DiagnosticDescriptor descriptor,
IEnumerable<UsingDirectiveSyntax> usingDirectives, CodeStyleOption<AddImportPlacement> option)
{
foreach (var usingDirective in usingDirectives)
{
context.ReportDiagnostic(DiagnosticHelper.Create(
descriptor,
usingDirective.GetLocation(),
option.Notification.Severity,
additionalLocations: null,
properties: null));
}
}
}
}
......@@ -12,6 +12,16 @@
<target state="translated">Opravit interpolovaný doslovný řetězec</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (Pro vložení stiskněte TAB.)</target>
......@@ -27,6 +37,21 @@
<target state="translated">Rozdělit řetězec</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">Interpolierte ausführliche Zeichenfolge korrigieren</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (Zum Einfügen TAB-TASTE drücken)</target>
......@@ -27,6 +37,21 @@
<target state="translated">Zeichenfolge teilen</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">Corregir cadena textual interpolada</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (Presione TAB para insertar)</target>
......@@ -27,6 +37,21 @@
<target state="translated">Dividir cadena</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">Corriger la chaîne textuelle interpolée</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (Appuyez sur TAB pour insérer)</target>
......@@ -27,6 +37,21 @@
<target state="translated">Fractionner la chaîne</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">Correggi stringa verbatim interpolata</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (Premere TAB per inserire)</target>
......@@ -27,6 +37,21 @@
<target state="translated">Dividi stringa</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">挿入された逐語的文字列を修正します</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated">(Tab キーを押して挿入)</target>
......@@ -27,6 +37,21 @@
<target state="translated">文字列を分割します</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">보간된 축자 문자열 수정</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (삽입하려면 &lt;Tab&gt; 키 누름)</target>
......@@ -27,6 +37,21 @@
<target state="translated">문자열 분할</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">Napraw interpolowany ciąg dosłownego wyrażenia</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (Naciśnij klawisz TAB, aby wstawić)</target>
......@@ -27,6 +37,21 @@
<target state="translated">Rozdziel ciąg</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">Corrigir cadeia de caracteres textual interpolada</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (Pressione TAB para inserir)</target>
......@@ -27,6 +37,21 @@
<target state="translated">Dividir cadeia de caracteres</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">Исправить интерполированную строку verbatim</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (Нажмите клавишу TAB для вставки)</target>
......@@ -27,6 +37,21 @@
<target state="translated">Разделить строку</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">Ara değer olarak eklenmiş tam dizeyi düzelt</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (Eklemek için TAB tuşuna basın)</target>
......@@ -27,6 +37,21 @@
<target state="translated">Dizeyi böl</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">修复插值的逐字字符串</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated">(按 Tab 插入)</target>
......@@ -27,6 +37,21 @@
<target state="translated">拆分字符串</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -12,6 +12,16 @@
<target state="translated">修正插入的逐字字串</target>
<note />
</trans-unit>
<trans-unit id="Misplaced_using_directive">
<source>Misplaced using directive</source>
<target state="new">Misplaced using directive</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Move_misplaced_using_directives">
<source>Move misplaced using directives</source>
<target state="new">Move misplaced using directives</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Press_TAB_to_insert">
<source> (Press TAB to insert)</source>
<target state="translated"> (按 TAB 鍵插入)</target>
......@@ -27,6 +37,21 @@
<target state="translated">分割字串</target>
<note />
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_inside_of_a_namespace_declaration">
<source>Using directives must be placed inside of a namespace declaration</source>
<target state="new">Using directives must be placed inside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Using_directives_must_be_placed_outside_of_a_namespace_declaration">
<source>Using directives must be placed outside of a namespace declaration</source>
<target state="new">Using directives must be placed outside of a namespace declaration</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized. {Locked="namespace"} "namespace" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Warning_colon_Moving_using_directives_may_change_code_meaning">
<source>Warning: Moving using directives may change code meaning.</source>
<target state="new">Warning: Moving using directives may change code meaning.</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -40,6 +40,7 @@ internal static class PredefinedCodeFixProviderNames
public const string MakeFieldReadonly = nameof(MakeFieldReadonly);
public const string MakeStatementAsynchronous = nameof(MakeStatementAsynchronous);
public const string MakeMethodSynchronous = nameof(MakeMethodSynchronous);
public const string MoveMisplacedUsingDirectives = nameof(MoveMisplacedUsingDirectives);
public const string MoveToTopOfFile = nameof(MoveToTopOfFile);
public const string PopulateSwitch = nameof(PopulateSwitch);
public const string QualifyMemberAccess = nameof(QualifyMemberAccess);
......
......@@ -107,6 +107,7 @@ internal static class IDEDiagnosticIds
public const string MakeStructFieldsWritable = "IDE0064";
public const string MoveMisplacedUsingDirectivesDiagnosticId = "IDE0065";
// Analyzer error Ids
public const string AnalyzerChangedId = "IDE1001";
......
......@@ -654,6 +654,15 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Inside namespace.
/// </summary>
internal static string Inside_namespace {
get {
return ResourceManager.GetString("Inside_namespace", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Label Indentation.
/// </summary>
......@@ -780,6 +789,15 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Outside namespace.
/// </summary>
internal static string Outside_namespace {
get {
return ResourceManager.GetString("Outside_namespace", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Perform additional code cleanup during formatting.
/// </summary>
......@@ -1077,6 +1095,15 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Preferred &apos;using&apos; directive placement.
/// </summary>
internal static string Preferred_using_directive_placement {
get {
return ResourceManager.GetString("Preferred_using_directive_placement", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Qualify event access with &apos;this&apos;.
/// </summary>
......@@ -1392,6 +1419,15 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to &apos;using&apos; preferences:.
/// </summary>
internal static string using_preferences_colon {
get {
return ResourceManager.GetString("using_preferences_colon", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &apos;var&apos; preferences:.
/// </summary>
......
......@@ -577,4 +577,20 @@
<data name="Show_items_from_unimported_namespaces" xml:space="preserve">
<value>Show items from unimported namespaces (experimental)</value>
</data>
<data name="Inside_namespace" xml:space="preserve">
<value>Inside namespace</value>
<comment>'namespace' is a C# keyword and should not be localized</comment>
</data>
<data name="Outside_namespace" xml:space="preserve">
<value>Outside namespace</value>
<comment>'namespace' is a C# keyword and should not be localized</comment>
</data>
<data name="Preferred_using_directive_placement" xml:space="preserve">
<value>Preferred 'using' directive placement</value>
<comment>'using' is a C# keyword and should not be localized</comment>
</data>
<data name="using_preferences_colon" xml:space="preserve">
<value>'using' preferences:</value>
<comment>'using' is a C# keyword and should not be localized</comment>
</data>
</root>
\ No newline at end of file
......@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Windows.Data;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.AddImports;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.Options;
......@@ -1164,6 +1165,34 @@ class Customer2
}}
";
private static readonly string[] s_usingDirectivePlacement = new[] { $@"
//[
namespace Namespace
{{
// {CSharpVSResources.Inside_namespace}
using System;
using System.Linq;
class Customer
{{
}}
}}
//]", $@"
//[
// {CSharpVSResources.Outside_namespace}
using System;
using System.Linq;
namespace Namespace
{{
class Customer
{{
}}
}}
//]
" };
private static readonly string s_preferStaticLocalFunction = $@"
class Customer1
{{
......@@ -1510,12 +1539,19 @@ internal StyleViewModel(OptionStore optionStore, IServiceProvider serviceProvide
var predefinedTypesGroupTitle = CSharpVSResources.predefined_type_preferences_colon;
var varGroupTitle = CSharpVSResources.var_preferences_colon;
var nullCheckingGroupTitle = CSharpVSResources.null_checking_colon;
var usingsGroupTitle = CSharpVSResources.using_preferences_colon;
var modifierGroupTitle = ServicesVSResources.Modifier_preferences_colon;
var codeBlockPreferencesGroupTitle = ServicesVSResources.Code_block_preferences_colon;
var expressionPreferencesGroupTitle = ServicesVSResources.Expression_preferences_colon;
var variablePreferencesGroupTitle = ServicesVSResources.Variable_preferences_colon;
var parameterPreferencesGroupTitle = ServicesVSResources.Parameter_preferences_colon;
var usingDirectivePlacementPreferences = new List<CodeStylePreference>
{
new CodeStylePreference(CSharpVSResources.Inside_namespace, isChecked: false),
new CodeStylePreference(CSharpVSResources.Outside_namespace, isChecked: false),
};
var qualifyMemberAccessPreferences = new List<CodeStylePreference>
{
new CodeStylePreference(CSharpVSResources.Prefer_this, isChecked: true),
......@@ -1585,6 +1621,12 @@ internal StyleViewModel(OptionStore optionStore, IServiceProvider serviceProvide
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferNullPropagation, ServicesVSResources.Prefer_null_propagation, s_preferNullPropagation, s_preferNullPropagation, this, optionStore, nullCheckingGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferIsNullCheckOverReferenceEqualityMethod, CSharpVSResources.Prefer_is_null_for_reference_equality_checks, s_preferIsNullOverReferenceEquals, s_preferIsNullOverReferenceEquals, this, optionStore, nullCheckingGroupTitle));
// Using directive preferences.
CodeStyleItems.Add(new EnumCodeStyleOptionViewModel<AddImportPlacement>(
CSharpCodeStyleOptions.PreferredUsingDirectivePlacement, CSharpVSResources.Preferred_using_directive_placement,
new[] { AddImportPlacement.InsideNamespace, AddImportPlacement.OutsideNamespace },
s_usingDirectivePlacement, this, optionStore, usingsGroupTitle, usingDirectivePlacementPreferences));
// Modifier preferences.
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferReadonly, ServicesVSResources.Prefer_readonly_fields, s_preferReadonly, s_preferReadonly, this, optionStore, modifierGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferStaticLocalFunction, ServicesVSResources.Prefer_static_local_functions, s_preferStaticLocalFunction, s_preferStaticLocalFunction, this, optionStore, modifierGroupTitle));
......
......@@ -42,6 +42,16 @@
<target state="translated">V relačních operátorech: &lt; &gt; &lt;= &gt;= is as == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">Při formátování provést dodatečné čištění kódu</target>
......@@ -52,6 +62,11 @@
<target state="translated">U kontrol rovnosti odkazů dávat přednost možnosti is null</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">Odebrat nepotřebné direktivy using</target>
......@@ -597,6 +612,11 @@
<target state="translated">'Předvolby pro „this.“:</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'Předvolby pro „var“:</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">In relationalen Operatoren: &lt; &gt; &lt;= &gt;= is as == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">Zusätzliche Codebereinigung während der Formatierung durchführen</target>
......@@ -52,6 +62,11 @@
<target state="translated">"is null" für Verweisübereinstimmungsprüfungen vorziehen</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">Nicht benötigte Using-Direktiven entfernen</target>
......@@ -597,6 +612,11 @@
<target state="translated">'this.-Einstellungen:</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'var-Einstellungen:</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">En los operadores relacionales: &lt; &gt; &lt;= &gt;= is as == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">Realizar limpieza de código adicional durante la aplicación de formato</target>
......@@ -52,6 +62,11 @@
<target state="translated">Preferir “is null” para comprobaciones de igualdad de referencias</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">Eliminar instrucciones Using innecesarias</target>
......@@ -597,6 +612,11 @@
<target state="translated">'Preferencias de "this.":</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'Preferencias de 'var':</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">Dans les opérateurs relationnels : &lt; &gt; &lt;= &gt;= is as == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">Effectuer un nettoyage supplémentaire du code pendant la mise en forme</target>
......@@ -52,6 +62,11 @@
<target state="translated">Préférer 'is nul' pour les vérifications d'égalité de référence</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">Supprimer les Usings inutiles</target>
......@@ -597,6 +612,11 @@
<target state="translated">'Préférences 'this.' :</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'Préférences 'var' :</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">In operatori relazionali: &lt; &gt; &lt;= &gt;= is as == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">Esegui la pulizia aggiuntiva del codice durante la formattazione</target>
......@@ -52,6 +62,11 @@
<target state="translated">Preferisci 'is null' per i controlli di uguaglianza dei riferimenti</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">Rimuovi istruzioni using non necessarie</target>
......@@ -597,6 +612,11 @@
<target state="translated">'Preferenze per 'this.':</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'Preferenze per 'var':</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">関係演算子: &lt; &gt; &lt;= &gt;= is as == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">書式設定中に追加のコード クリーンアップを実行</target>
......@@ -52,6 +62,11 @@
<target state="translated">参照の等値性のチェックには 'is null' を優先する</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">不要な using の削除</target>
......@@ -597,6 +612,11 @@
<target state="translated">'this' の優先:</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'var' を優先:</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">관계 연산자: &lt; &gt; &lt;= &gt;= is as == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">서식을 지정하는 동안 추가 코드 정리 수행</target>
......@@ -52,6 +62,11 @@
<target state="translated">참조 같음 검사에 대해 'is null' 선호</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">불필요한 Using 제거</target>
......@@ -597,6 +612,11 @@
<target state="translated">'this.' 기본 설정:</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'var' 기본 설정:</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">W operatorach relacyjnych: &lt; &gt; &lt;= &gt;= is as == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">Wykonaj dodatkowe oczyszczanie kodu podczas formatowania</target>
......@@ -52,6 +62,11 @@
<target state="translated">Preferuj wyrażenie „is null” w przypadku sprawdzeń odwołań pod kątem równości</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">Usuń niepotrzebne użycia</target>
......@@ -597,6 +612,11 @@
<target state="translated">'Preferencje dotyczące elementu „this.”:</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'Preferencje elementu „var”:</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">Em operadores relacionais: &lt; &gt; &lt;= &gt;= is as == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">Executar limpeza de código adicional durante a formatação</target>
......@@ -52,6 +62,11 @@
<target state="translated">Preferir 'is null' para as verificações de igualdade de referência</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">Remover Usos Desnecessários</target>
......@@ -597,6 +612,11 @@
<target state="translated">'Preferências de 'this.':</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'Preferências de 'var':</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">В реляционных операторах: &lt; &gt; &lt;= &gt;= is as == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">Выполнять при форматировании дополнительную очистку кода</target>
......@@ -52,6 +62,11 @@
<target state="translated">Использовать "is null" вместо проверки ссылок на равенство.</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">Удалить ненужные директивы using</target>
......@@ -597,6 +612,11 @@
<target state="translated">'предпочтения "this.":</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'предпочтения "var":</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">İlişkisel işleçleri içinde: &lt;&gt; = &lt; &gt; = == gibi! =</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">Biçimlendirme sırasında ek kod temizleme gerçekleştir</target>
......@@ -52,6 +62,11 @@
<target state="translated">Başvuru eşitliği denetimleri için 'is null'ı tercih et</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">Gereksiz Kullanımları Kaldır</target>
......@@ -597,6 +612,11 @@
<target state="translated">'This' tercihleri:</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'var' tercihleri:</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">在关系运算符中: &lt; &gt; &lt;= &gt;= 等同于 == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">在格式设置期间执行其他代码清理</target>
......@@ -52,6 +62,11 @@
<target state="translated">引用相等检查偏好 “is null”</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">删除不必要的 Using</target>
......@@ -597,6 +612,11 @@
<target state="translated">'"this." 首选项:</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'"var" 首选项:</target>
......
......@@ -42,6 +42,16 @@
<target state="translated">在關係運算子中: &lt; &gt; &lt;= &gt;= 如同 == !=</target>
<note />
</trans-unit>
<trans-unit id="Inside_namespace">
<source>Inside namespace</source>
<target state="new">Inside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Outside_namespace">
<source>Outside namespace</source>
<target state="new">Outside namespace</target>
<note>'namespace' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Perform_additional_code_cleanup_during_formatting">
<source>Perform additional code cleanup during formatting</source>
<target state="translated">在格式化期間執行額外程式碼清除</target>
......@@ -52,6 +62,11 @@
<target state="translated">參考相等檢查最好使用 'is null'</target>
<note>'is null' is a C# string and should not be localized.</note>
</trans-unit>
<trans-unit id="Preferred_using_directive_placement">
<source>Preferred 'using' directive placement</source>
<target state="new">Preferred 'using' directive placement</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Remove_unnecessary_usings">
<source>Remove unnecessary usings</source>
<target state="translated">移除不必要的 Using</target>
......@@ -597,6 +612,11 @@
<target state="translated">'this.' 喜好設定:</target>
<note />
</trans-unit>
<trans-unit id="using_preferences_colon">
<source>'using' preferences:</source>
<target state="new">'using' preferences:</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="var_preferences_colon">
<source>'var' preferences:</source>
<target state="translated">'var' 喜歡設定:</target>
......
......@@ -120,6 +120,9 @@ csharp_style_prefer_range_operator = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:silent
#### C# Formatting Rules ####
# New line preferences
......@@ -325,6 +328,9 @@ csharp_style_prefer_range_operator = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:silent
#### C# Formatting Rules ####
# New line preferences
......
......@@ -10,7 +10,6 @@
namespace Microsoft.CodeAnalysis.CSharp {
using System;
using System.Reflection;
/// <summary>
......@@ -20,7 +19,7 @@ namespace Microsoft.CodeAnalysis.CSharp {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class CSharpWorkspaceResources {
......@@ -40,7 +39,7 @@ internal class CSharpWorkspaceResources {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.CSharp.CSharpWorkspaceResources", typeof(CSharpWorkspaceResources).GetTypeInfo().Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.CSharp.CSharpWorkspaceResources", typeof(CSharpWorkspaceResources).Assembly);
resourceMan = temp;
}
return resourceMan;
......@@ -197,6 +196,15 @@ internal class CSharpWorkspaceResources {
}
}
/// <summary>
/// Looks up a localized string similar to &apos;using&apos; directive preferences.
/// </summary>
internal static string using_directive_preferences {
get {
return ResourceManager.GetString("using_directive_preferences", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to var preferences.
/// </summary>
......
......@@ -168,4 +168,8 @@
<data name="Wrapping_preferences" xml:space="preserve">
<value>Wrapping preferences</value>
</data>
<data name="using_directive_preferences" xml:space="preserve">
<value>'using' directive preferences</value>
<comment>{Locked="using"} "using" is a C# keyword and should not be localized.</comment>
</data>
</root>
\ No newline at end of file
......@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis.AddImports;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.Options;
......@@ -227,6 +228,19 @@ private static Option<T> CreateOption<T>(OptionGroup group, string name, T defau
EditorConfigStorageLocation.ForBoolCodeStyleOption("csharp_style_pattern_local_over_anonymous_function"),
new RoamingProfileStorageLocation($"TextEditor.CSharp.Specific.{nameof(PreferLocalOverAnonymousFunction)}")});
public static readonly CodeStyleOption<AddImportPlacement> PreferOutsidePlacementWithSilentEnforcement =
new CodeStyleOption<AddImportPlacement>(AddImportPlacement.OutsideNamespace, NotificationOption.Silent);
public static readonly Option<CodeStyleOption<AddImportPlacement>> PreferredUsingDirectivePlacement = CreateOption(
CSharpCodeStyleOptionGroups.UsingDirectivePreferences, nameof(PreferredUsingDirectivePlacement),
defaultValue: PreferOutsidePlacementWithSilentEnforcement,
storageLocations: new OptionStorageLocation[]{
new EditorConfigStorageLocation<CodeStyleOption<AddImportPlacement>>(
"csharp_using_directive_placement",
s => ParseUsingDirectivesPlacement(s, PreferOutsidePlacementWithSilentEnforcement),
GetUsingDirectivesPlacementEditorConfigString),
new RoamingProfileStorageLocation($"TextEditor.CSharp.Specific.{nameof(PreferredUsingDirectivePlacement)}") });
internal static readonly Option<CodeStyleOption<UnusedValuePreference>> UnusedValueExpressionStatement =
CodeStyleHelpers.CreateUnusedExpressionAssignmentOption(
CSharpCodeStyleOptionGroups.ExpressionLevelPreferences,
......@@ -287,5 +301,6 @@ internal static class CSharpCodeStyleOptionGroups
public static readonly OptionGroup Modifier = new OptionGroup(WorkspacesResources.Modifier_preferences, priority: 5);
public static readonly OptionGroup CodeBlockPreferences = new OptionGroup(CSharpWorkspaceResources.Code_block_preferences, priority: 6);
public static readonly OptionGroup ExpressionLevelPreferences = new OptionGroup(WorkspacesResources.Expression_level_preferences, priority: 7);
public static readonly OptionGroup UsingDirectivePreferences = new OptionGroup(CSharpWorkspaceResources.using_directive_preferences, priority: 8);
}
}
......@@ -2,6 +2,7 @@
using System;
using System.Diagnostics;
using Microsoft.CodeAnalysis.AddImports;
using Microsoft.CodeAnalysis.CodeStyle;
using Roslyn.Utilities;
......@@ -51,6 +52,45 @@ private static string GetExpressionBodyPreferenceEditorConfigString(CodeStyleOpt
}
}
public static CodeStyleOption<AddImportPlacement> ParseUsingDirectivesPlacement(
string optionString, CodeStyleOption<AddImportPlacement> @default)
{
// optionString must be similar to outside_namespace:error or inside_namespace:suggestion.
if (CodeStyleHelpers.TryGetCodeStyleValueAndOptionalNotification(
optionString, out var value, out var notificationOpt))
{
// A notification value must be provided.
if (notificationOpt != null)
{
switch (value)
{
case "inside_namespace":
return new CodeStyleOption<AddImportPlacement>(AddImportPlacement.InsideNamespace, notificationOpt);
case "outside_namespace":
return new CodeStyleOption<AddImportPlacement>(AddImportPlacement.OutsideNamespace, notificationOpt);
default:
throw new NotSupportedException();
}
}
}
return @default;
}
public static string GetUsingDirectivesPlacementEditorConfigString(CodeStyleOption<AddImportPlacement> value)
{
Debug.Assert(value.Notification != null);
var notificationString = value.Notification.ToEditorConfigString();
switch (value.Value)
{
case AddImportPlacement.InsideNamespace: return $"inside_namespace:{notificationString}";
case AddImportPlacement.OutsideNamespace: return $"outside_namespace:{notificationString}";
default:
throw new NotSupportedException();
}
}
private static CodeStyleOption<PreferBracesPreference> ParsePreferBracesPreference(
string optionString,
CodeStyleOption<PreferBracesPreference> defaultValue)
......
......@@ -49,6 +49,7 @@ public override void WriteTo(OptionSet options, ObjectWriter writer, Cancellatio
WriteOptionTo(options, CSharpCodeStyleOptions.PreferBraces, writer, cancellationToken);
WriteOptionTo(options, CSharpCodeStyleOptions.PreferredModifierOrder, writer, cancellationToken);
WriteOptionTo(options, CSharpCodeStyleOptions.PreferredUsingDirectivePlacement, writer, cancellationToken);
WriteOptionTo(options, CSharpCodeStyleOptions.PreferStaticLocalFunction, writer, cancellationToken);
}
......@@ -70,6 +71,7 @@ public override OptionSet ReadOptionSetFrom(ObjectReader reader, CancellationTok
options = ReadOptionFrom(options, CSharpCodeStyleOptions.PreferBraces, reader, cancellationToken);
options = ReadOptionFrom(options, CSharpCodeStyleOptions.PreferredModifierOrder, reader, cancellationToken);
options = ReadOptionFrom(options, CSharpCodeStyleOptions.PreferredUsingDirectivePlacement, reader, cancellationToken);
options = ReadOptionFrom(options, CSharpCodeStyleOptions.PreferStaticLocalFunction, reader, cancellationToken);
return options;
......
......@@ -82,6 +82,11 @@
<target state="translated">Předvolby obálek</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">Předvolby pro var</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">Einstellungen für Umbrüche</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">Var-Einstellungen</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">Preferencias de encapsulado</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">Preferencias de var</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">Préférences de retour à la ligne</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">Préférences de var</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">Preferenze per ritorno a capo</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">Preferenze per var</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">折り返しの設定</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">var を優先</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">기본 설정 줄 바꿈</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">var 기본 설정</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">Preferencje zawijania</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">Preferencje zmiennych</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">Preferências de disposição</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">preferências de var</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">Предпочтения переноса</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">Предпочтения var</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">Kaydırma tercihleri</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">var tercihleri</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">包装首选项</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">var 首选项</target>
......
......@@ -82,6 +82,11 @@
<target state="translated">換行喜好設定</target>
<note />
</trans-unit>
<trans-unit id="using_directive_preferences">
<source>'using' directive preferences</source>
<target state="new">'using' directive preferences</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="var_preferences">
<source>var preferences</source>
<target state="translated">var 喜好設定</target>
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.AddImports
{
/// <summary>
/// Specifies the desired placement of added imports.
/// </summary>
internal enum AddImportPlacement
{
/// <summary>
/// Place imports inside the namespace definition.
/// </summary>
InsideNamespace,
/// <summary>
/// Place imports outside the namespace definition.
/// </summary>
OutsideNamespace
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册