提交 97f550a1 编写于 作者: C Cyrus Najmabadi

Add UI

上级 40638404
...@@ -813,6 +813,38 @@ void Method() ...@@ -813,6 +813,38 @@ void Method()
}} }}
//] //]
}} }}
";
private static readonly string s_preferSystemHashCode = $@"
using System;
class Customer1
{{
int a, b, c;
//[
// {ServicesVSResources.Prefer_colon}
// {ServicesVSResources.Requires_System_HashCode_be_present_in_project}
public override int GetHashCode()
{{
return System.HashCode.Combine(a, b, c);
}}
//]
}}
class Customer2
{{
int a, b, c;
//[
// {ServicesVSResources.Over_colon}
public override int GetHashCode()
{{
var hashCode = 339610899;
hashCode = hashCode * -1521134295 + a.GetHashCode();
hashCode = hashCode * -1521134295 + b.GetHashCode();
hashCode = hashCode * -1521134295 + c.GetHashCode();
return hashCode;
}}
//]
}}
"; ";
private static readonly string s_preferLocalFunctionOverAnonymousFunction = $@" private static readonly string s_preferLocalFunctionOverAnonymousFunction = $@"
...@@ -1617,6 +1649,7 @@ internal StyleViewModel(OptionStore optionStore, IServiceProvider serviceProvide ...@@ -1617,6 +1649,7 @@ internal StyleViewModel(OptionStore optionStore, IServiceProvider serviceProvide
AddBracesOptions(optionStore, codeBlockPreferencesGroupTitle); AddBracesOptions(optionStore, codeBlockPreferencesGroupTitle);
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferAutoProperties, ServicesVSResources.analyzer_Prefer_auto_properties, s_preferAutoProperties, s_preferAutoProperties, this, optionStore, codeBlockPreferencesGroupTitle)); CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferAutoProperties, ServicesVSResources.analyzer_Prefer_auto_properties, s_preferAutoProperties, s_preferAutoProperties, this, optionStore, codeBlockPreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferSimpleUsingStatement, ServicesVSResources.Prefer_simple_using_statement, s_preferSimpleUsingStatement, s_preferSimpleUsingStatement, this, optionStore, codeBlockPreferencesGroupTitle)); CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferSimpleUsingStatement, ServicesVSResources.Prefer_simple_using_statement, s_preferSimpleUsingStatement, s_preferSimpleUsingStatement, this, optionStore, codeBlockPreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferSystemHashCode, ServicesVSResources.Prefer_System_HashCode_in_GetHashCode, s_preferSystemHashCode, s_preferSystemHashCode, this, optionStore, codeBlockPreferencesGroupTitle));
AddParenthesesOptions(OptionStore); AddParenthesesOptions(OptionStore);
......
...@@ -2423,6 +2423,15 @@ internal class ServicesVSResources { ...@@ -2423,6 +2423,15 @@ internal class ServicesVSResources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Prefer &apos;System.HashCode&apos; in &apos;GetHashCode&apos;.
/// </summary>
internal static string Prefer_System_HashCode_in_GetHashCode {
get {
return ResourceManager.GetString("Prefer_System_HashCode_in_GetHashCode", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to prefer throwing properties. /// Looks up a localized string similar to prefer throwing properties.
/// </summary> /// </summary>
...@@ -2717,6 +2726,15 @@ internal class ServicesVSResources { ...@@ -2717,6 +2726,15 @@ internal class ServicesVSResources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Requires &apos;System.HashCode&apos; be present in project.
/// </summary>
internal static string Requires_System_HashCode_be_present_in_project {
get {
return ResourceManager.GetString("Requires_System_HashCode_be_present_in_project", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Reset Visual Studio default keymapping. /// Looks up a localized string similar to Reset Visual Studio default keymapping.
/// </summary> /// </summary>
......
...@@ -1323,4 +1323,10 @@ I agree to all of the foregoing:</value> ...@@ -1323,4 +1323,10 @@ I agree to all of the foregoing:</value>
<data name="Updating_severity" xml:space="preserve"> <data name="Updating_severity" xml:space="preserve">
<value>Updating severity</value> <value>Updating severity</value>
</data> </data>
<data name="Prefer_System_HashCode_in_GetHashCode" xml:space="preserve">
<value>Prefer 'System.HashCode' in 'GetHashCode'</value>
</data>
<data name="Requires_System_HashCode_be_present_in_project" xml:space="preserve">
<value>Requires 'System.HashCode' be present in project</value>
</data>
</root> </root>
\ No newline at end of file
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">Pozastaveno (počet úloh ve frontě: {0})</target> <target state="translated">Pozastaveno (počet úloh ve frontě: {0})</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">Preferovat složená přiřazení</target> <target state="translated">Preferovat složená přiřazení</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">Nahlásit neplatné regulární výrazy</target> <target state="translated">Nahlásit neplatné regulární výrazy</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Obnovit výchozí mapování klávesnice sady Visual Studio</target> <target state="translated">Obnovit výchozí mapování klávesnice sady Visual Studio</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">Angehalten ({0} Tasks in der Warteschlange)</target> <target state="translated">Angehalten ({0} Tasks in der Warteschlange)</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">Zusammengesetzte Zuweisungen bevorzugen</target> <target state="translated">Zusammengesetzte Zuweisungen bevorzugen</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">Ungültige reguläre Ausdrücke melden</target> <target state="translated">Ungültige reguläre Ausdrücke melden</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Visual Studio-Standardtastenzuordnung zurücksetzen</target> <target state="translated">Visual Studio-Standardtastenzuordnung zurücksetzen</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">En pausa ({0} tareas en cola)</target> <target state="translated">En pausa ({0} tareas en cola)</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">Preferir asignaciones compuestas</target> <target state="translated">Preferir asignaciones compuestas</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">Notificar expresiones regulares no válidas</target> <target state="translated">Notificar expresiones regulares no válidas</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Restablecer asignaciones de teclado predeterminadas de Visual Studio</target> <target state="translated">Restablecer asignaciones de teclado predeterminadas de Visual Studio</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">Suspendu ({0} tâches en file d'attente)</target> <target state="translated">Suspendu ({0} tâches en file d'attente)</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">Préférer les affectations composées</target> <target state="translated">Préférer les affectations composées</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">Signaler les expressions régulières non valides</target> <target state="translated">Signaler les expressions régulières non valides</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Réinitialiser la configuration du clavier par défaut de Visual Studio</target> <target state="translated">Réinitialiser la configuration du clavier par défaut de Visual Studio</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">Sospeso ({0} attività in coda)</target> <target state="translated">Sospeso ({0} attività in coda)</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">Preferisci assegnazioni composte</target> <target state="translated">Preferisci assegnazioni composte</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">Segnala espressioni regolari non valide</target> <target state="translated">Segnala espressioni regolari non valide</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Reimposta il mapping dei tasti predefinito di Visual Studio</target> <target state="translated">Reimposta il mapping dei tasti predefinito di Visual Studio</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">一時停止中 ({0} 個のタスクがキューにあります)</target> <target state="translated">一時停止中 ({0} 個のタスクがキューにあります)</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">複合割り当てを優先</target> <target state="translated">複合割り当てを優先</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">無効な正規表現を報告</target> <target state="translated">無効な正規表現を報告</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Visual Studio の既定のキーマップをリセットします</target> <target state="translated">Visual Studio の既定のキーマップをリセットします</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">일시 중지됨(큐의 {0}개 작업)</target> <target state="translated">일시 중지됨(큐의 {0}개 작업)</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">복합 대입 선호</target> <target state="translated">복합 대입 선호</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">잘못된 정규식 보고</target> <target state="translated">잘못된 정규식 보고</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Visual Studio 기본 키 매핑을 다시 설정</target> <target state="translated">Visual Studio 기본 키 매핑을 다시 설정</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">Wstrzymano (zadania w kolejce: {0})</target> <target state="translated">Wstrzymano (zadania w kolejce: {0})</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">Preferuj przypisania złożone</target> <target state="translated">Preferuj przypisania złożone</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">Raportuj nieprawidłowe wyrażenia regularne</target> <target state="translated">Raportuj nieprawidłowe wyrażenia regularne</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Zresetuj domyślne mapowanie klawiszy programu Visual Studio</target> <target state="translated">Zresetuj domyślne mapowanie klawiszy programu Visual Studio</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">Em pausa ({0} tarefas na fila)</target> <target state="translated">Em pausa ({0} tarefas na fila)</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">Preferir atribuições de compostos</target> <target state="translated">Preferir atribuições de compostos</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">Relatar expressões regulares inválidas</target> <target state="translated">Relatar expressões regulares inválidas</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Redefinir mapeamento de teclas padrão do Visual Studio</target> <target state="translated">Redefinir mapeamento de teclas padrão do Visual Studio</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">Приостановлено (задач в очереди: {0})</target> <target state="translated">Приостановлено (задач в очереди: {0})</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">Предпочитать составные присваивания</target> <target state="translated">Предпочитать составные присваивания</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">Сообщать о недопустимых регулярных выражениях</target> <target state="translated">Сообщать о недопустимых регулярных выражениях</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Сброс схемы назначения клавиш Visual Studio по умолчанию</target> <target state="translated">Сброс схемы назначения клавиш Visual Studio по умолчанию</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">Duraklatıldı (kuyrukta {0} görev var)</target> <target state="translated">Duraklatıldı (kuyrukta {0} görev var)</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">Bileşik atamaları tercih et</target> <target state="translated">Bileşik atamaları tercih et</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">Geçersiz normal ifadeleri bildir</target> <target state="translated">Geçersiz normal ifadeleri bildir</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">Visual Studio varsayılan tuş eşlemesine sıfırla</target> <target state="translated">Visual Studio varsayılan tuş eşlemesine sıfırla</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">已暂停(队列中有 {0} 个任务)</target> <target state="translated">已暂停(队列中有 {0} 个任务)</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">首选复合赋值</target> <target state="translated">首选复合赋值</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">报告无效的正规表达式</target> <target state="translated">报告无效的正规表达式</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">重置 Visual Studio 默认项映射</target> <target state="translated">重置 Visual Studio 默认项映射</target>
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
<target state="translated">已暫停 (佇列中的 {0} 工作)</target> <target state="translated">已暫停 (佇列中的 {0} 工作)</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Prefer_System_HashCode_in_GetHashCode">
<source>Prefer 'System.HashCode' in 'GetHashCode'</source>
<target state="new">Prefer 'System.HashCode' in 'GetHashCode'</target>
<note />
</trans-unit>
<trans-unit id="Prefer_compound_assignments"> <trans-unit id="Prefer_compound_assignments">
<source>Prefer compound assignments</source> <source>Prefer compound assignments</source>
<target state="translated">優先使用複合指派</target> <target state="translated">優先使用複合指派</target>
...@@ -402,6 +407,11 @@ ...@@ -402,6 +407,11 @@
<target state="translated">回報無效的規則運算式</target> <target state="translated">回報無效的規則運算式</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Requires_System_HashCode_be_present_in_project">
<source>Requires 'System.HashCode' be present in project</source>
<target state="new">Requires 'System.HashCode' be present in project</target>
<note />
</trans-unit>
<trans-unit id="Reset_Visual_Studio_default_keymapping"> <trans-unit id="Reset_Visual_Studio_default_keymapping">
<source>Reset Visual Studio default keymapping</source> <source>Reset Visual Studio default keymapping</source>
<target state="translated">重設 Visual Studio 預設按鍵對應</target> <target state="translated">重設 Visual Studio 預設按鍵對應</target>
......
...@@ -349,6 +349,34 @@ Class Customer2 ...@@ -349,6 +349,34 @@ Class Customer2
End Property End Property
//] //]
End Class End Class
"
Private Shared ReadOnly s_preferSystemHashCode As String = $"
Imports System
Class Customer1
Dim a, b, c As Integer
//[
' {ServicesVSResources.Prefer_colon}
// {ServicesVSResources.Requires_System_HashCode_be_present_in_project}
Public Overrides Function GetHashCodeAsInteger()
Return System.HashCode.Combine(a, b, c)
End Function
//]
End Class
Class Customer2
Dim a, b, c As Integer
//[
' {ServicesVSResources.Over_colon}
Public Overrides Function GetHashCodeAsInteger()
Dim hashCode = 339610899
hashCode = hashCode * -1521134295 + a.GetHashCode()
hashCode = hashCode * -1521134295 + b.GetHashCode()
hashCode = hashCode * -1521134295 + c.GetHashCode()
return hashCode
End Function
//]
End Class
" "
Private Shared ReadOnly s_preferIsNothingCheckOverReferenceEquals As String = $" Private Shared ReadOnly s_preferIsNothingCheckOverReferenceEquals As String = $"
...@@ -657,6 +685,7 @@ End Class ...@@ -657,6 +685,7 @@ End Class
' Code block ' Code block
Me.CodeStyleItems.Add(New BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferAutoProperties, ServicesVSResources.analyzer_Prefer_auto_properties, s_preferAutoProperties, s_preferAutoProperties, Me, optionStore, codeBlockPreferencesGroupTitle)) Me.CodeStyleItems.Add(New BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferAutoProperties, ServicesVSResources.analyzer_Prefer_auto_properties, s_preferAutoProperties, s_preferAutoProperties, Me, optionStore, codeBlockPreferencesGroupTitle))
Me.CodeStyleItems.Add(New BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferSystemHashCode, ServicesVSResources.Prefer_System_HashCode_in_GetHashCode, s_preferSystemHashCode, s_preferSystemHashCode, Me, optionStore, codeBlockPreferencesGroupTitle))
' expression preferences ' expression preferences
Me.CodeStyleItems.Add(New BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferObjectInitializer, ServicesVSResources.Prefer_object_initializer, s_preferObjectInitializer, s_preferObjectInitializer, Me, optionStore, expressionPreferencesGroupTitle)) Me.CodeStyleItems.Add(New BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferObjectInitializer, ServicesVSResources.Prefer_object_initializer, s_preferObjectInitializer, s_preferObjectInitializer, Me, optionStore, expressionPreferencesGroupTitle))
......
...@@ -358,11 +358,12 @@ private static string GetAccessibilityModifiersRequiredEditorConfigString(CodeSt ...@@ -358,11 +358,12 @@ private static string GetAccessibilityModifiersRequiredEditorConfigString(CodeSt
KeyValuePairUtil.Create("all", UnusedParametersPreference.AllMethods), KeyValuePairUtil.Create("all", UnusedParametersPreference.AllMethods),
}); });
internal static readonly PerLanguageOption<CodeStyleOption<bool>> PreferSystemHashCode = new PerLanguageOption<CodeStyleOption<bool>>( internal static readonly PerLanguageOption<CodeStyleOption<bool>> PreferSystemHashCode = CreateOption(
nameof(CodeStyleOptions), CodeStyleOptionGroups.ExpressionLevelPreferences,
nameof(PreferSystemHashCode), nameof(PreferSystemHashCode),
defaultValue: TrueWithSuggestionEnforcement, defaultValue: TrueWithSuggestionEnforcement,
storageLocations: new OptionStorageLocation[]{ storageLocations: new OptionStorageLocation[]{
EditorConfigStorageLocation.ForBoolCodeStyleOption("dotnet_prefer_system_hashcode"),
new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferSystemHashCode") }); new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferSystemHashCode") });
static CodeStyleOptions() static CodeStyleOptions()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册