Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
510b6e05
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
510b6e05
编写于
11月 15, 2016
作者:
D
David Poeschl
提交者:
GitHub
11月 15, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14974 from dpoeschl/LocalizeErrorWarningEtcInCodeStyleOptionPages
Localize "Error"/"Warning" etc. in the code style UIs
上级
ae4a285d
46d64f7a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
70 addition
and
78 deletion
+70
-78
src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/EnforcementLevel.cs
.../Impl/Options/Style/NamingPreferences/EnforcementLevel.cs
+0
-49
src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/NamingStyleOptionPageControl.xaml.cs
...le/NamingPreferences/NamingStyleOptionPageControl.xaml.cs
+10
-6
src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/NamingStyleOptionPageViewModel.cs
...Style/NamingPreferences/NamingStyleOptionPageViewModel.cs
+13
-11
src/VisualStudio/Core/Impl/ServicesVisualStudioImpl.csproj
src/VisualStudio/Core/Impl/ServicesVisualStudioImpl.csproj
+0
-1
src/Workspaces/Core/Portable/CodeStyle/NotificationOption.cs
src/Workspaces/Core/Portable/CodeStyle/NotificationOption.cs
+4
-4
src/Workspaces/Core/Portable/WorkspacesResources.Designer.cs
src/Workspaces/Core/Portable/WorkspacesResources.Designer.cs
+34
-7
src/Workspaces/Core/Portable/WorkspacesResources.resx
src/Workspaces/Core/Portable/WorkspacesResources.resx
+9
-0
未找到文件。
src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/EnforcementLevel.cs
已删除
100644 → 0
浏览文件 @
ae4a285d
// 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
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.VisualStudio.Imaging
;
using
Microsoft.VisualStudio.Imaging.Interop
;
namespace
Microsoft.VisualStudio.LanguageServices.Implementation.Options.Style.NamingPreferences
{
public
class
EnforcementLevel
{
public
EnforcementLevel
(
DiagnosticSeverity
severity
)
{
Value
=
severity
;
switch
(
severity
)
{
case
DiagnosticSeverity
.
Hidden
:
Name
=
"None"
;
Moniker
=
KnownMonikers
.
None
;
return
;
case
DiagnosticSeverity
.
Info
:
Name
=
"Suggestion"
;
Moniker
=
KnownMonikers
.
StatusInformation
;
return
;
case
DiagnosticSeverity
.
Warning
:
Name
=
"Warning"
;
Moniker
=
KnownMonikers
.
StatusWarning
;
return
;
case
DiagnosticSeverity
.
Error
:
Name
=
"Error"
;
Moniker
=
KnownMonikers
.
StatusError
;
return
;
default
:
throw
new
ArgumentException
(
"Unexpected DiagnosticSeverity"
,
nameof
(
severity
));
}
}
public
EnforcementLevel
(
string
name
,
DiagnosticSeverity
value
,
ImageMoniker
moniker
)
{
Name
=
name
;
Value
=
value
;
Moniker
=
moniker
;
}
public
ImageMoniker
Moniker
{
get
;
private
set
;
}
public
string
Name
{
get
;
private
set
;
}
public
DiagnosticSeverity
Value
{
get
;
private
set
;
}
}
}
src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/NamingStyleOptionPageControl.xaml.cs
浏览文件 @
510b6e05
...
...
@@ -8,9 +8,11 @@
using
System.Windows.Controls
;
using
System.Xml.Linq
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.CodeStyle
;
using
Microsoft.CodeAnalysis.Diagnostics.Analyzers.NamingStyles
;
using
Microsoft.CodeAnalysis.Notification
;
using
Microsoft.CodeAnalysis.Simplification
;
using
Microsoft.VisualStudio.Imaging
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.Options.Style.NamingPreferences
;
using
Microsoft.VisualStudio.PlatformUI
;
...
...
@@ -22,11 +24,13 @@ internal partial class NamingStyleOptionPageControl : AbstractOptionPageControl
private
readonly
string
_languageName
;
private
readonly
INotificationService
_notificationService
;
private
readonly
ImmutableArray
<
EnforcementLevel
>
_notifications
=
ImmutableArray
.
Create
(
new
EnforcementLevel
(
DiagnosticSeverity
.
Hidden
),
new
EnforcementLevel
(
DiagnosticSeverity
.
Info
),
new
EnforcementLevel
(
DiagnosticSeverity
.
Warning
),
new
EnforcementLevel
(
DiagnosticSeverity
.
Error
));
private
readonly
NotificationOptionViewModel
[]
_notifications
=
new
[]
{
new
NotificationOptionViewModel
(
NotificationOption
.
None
,
KnownMonikers
.
None
),
new
NotificationOptionViewModel
(
NotificationOption
.
Suggestion
,
KnownMonikers
.
StatusInformation
),
new
NotificationOptionViewModel
(
NotificationOption
.
Warning
,
KnownMonikers
.
StatusWarning
),
new
NotificationOptionViewModel
(
NotificationOption
.
Error
,
KnownMonikers
.
StatusError
)
};
internal
NamingStyleOptionPageControl
(
IServiceProvider
serviceProvider
,
INotificationService
notificationService
,
string
languageName
)
:
base
(
serviceProvider
)
...
...
@@ -137,7 +141,7 @@ internal override void SaveSettings()
var
rule
=
new
SerializableNamingRule
()
{
EnforcementLevel
=
item
.
SelectedNotificationPreference
.
Value
,
EnforcementLevel
=
item
.
SelectedNotificationPreference
.
Notification
.
Value
,
NamingStyleID
=
item
.
SelectedStyle
.
ID
,
SymbolSpecificationID
=
item
.
SelectedSpecification
.
ID
};
...
...
src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/NamingStyleOptionPageViewModel.cs
浏览文件 @
510b6e05
...
...
@@ -3,7 +3,9 @@
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.CodeStyle
;
using
Microsoft.CodeAnalysis.Diagnostics.Analyzers.NamingStyles
;
using
Microsoft.VisualStudio.Imaging
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.Options.Style.NamingPreferences
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.Utilities
;
...
...
@@ -14,12 +16,12 @@ internal class NamingStyleOptionPageViewModel : AbstractNotifyPropertyChanged
public
string
ManageSpecificationsButtonText
=>
ServicesVSResources
.
Manage_specifications
;
public
string
ManageStylesButtonText
=>
ServicesVSResources
.
Manage_styles
;
private
readonly
EnforcementLev
el
[]
_notifications
=
new
[]
private
readonly
NotificationOptionViewMod
el
[]
_notifications
=
new
[]
{
new
EnforcementLevel
(
DiagnosticSeverity
.
Hidden
),
new
EnforcementLevel
(
DiagnosticSeverity
.
Info
),
new
EnforcementLevel
(
DiagnosticSeverity
.
Warning
),
new
EnforcementLevel
(
DiagnosticSeverity
.
Error
),
new
NotificationOptionViewModel
(
NotificationOption
.
None
,
KnownMonikers
.
None
),
new
NotificationOptionViewModel
(
NotificationOption
.
Suggestion
,
KnownMonikers
.
StatusInformation
),
new
NotificationOptionViewModel
(
NotificationOption
.
Warning
,
KnownMonikers
.
Status
Warning
),
new
NotificationOptionViewModel
(
NotificationOption
.
Error
,
KnownMonikers
.
StatusError
)
};
public
ObservableCollection
<
NamingRuleViewModel
>
CodeStyleItems
{
get
;
set
;
}
...
...
@@ -35,11 +37,11 @@ public NamingStyleOptionPageViewModel(SerializableNamingStylePreferencesInfo inf
viewModel
.
NamingStyles
=
new
ObservableCollection
<
NamingStyle
>(
info
.
NamingStyles
);
viewModel
.
Specifications
=
new
ObservableCollection
<
SymbolSpecification
>(
info
.
SymbolSpecifications
);
viewModel
.
NotificationPreferences
=
new
List
<
EnforcementLev
el
>(
_notifications
);
viewModel
.
NotificationPreferences
=
new
List
<
NotificationOptionViewMod
el
>(
_notifications
);
viewModel
.
SelectedSpecification
=
viewModel
.
Specifications
.
Single
(
s
=>
s
.
ID
==
namingRule
.
SymbolSpecificationID
);
viewModel
.
SelectedStyle
=
viewModel
.
NamingStyles
.
Single
(
s
=>
s
.
ID
==
namingRule
.
NamingStyleID
);
viewModel
.
SelectedNotificationPreference
=
viewModel
.
NotificationPreferences
.
Single
(
n
=>
n
.
N
ame
==
new
EnforcementLevel
(
namingRule
.
EnforcementLevel
).
Name
);
viewModel
.
SelectedNotificationPreference
=
viewModel
.
NotificationPreferences
.
Single
(
n
=>
n
.
N
otification
.
Value
==
namingRule
.
EnforcementLevel
);
viewModels
.
Add
(
viewModel
);
}
...
...
@@ -196,16 +198,16 @@ public NamingRuleViewModel()
{
Specifications
=
new
ObservableCollection
<
SymbolSpecification
>();
NamingStyles
=
new
ObservableCollection
<
NamingStyle
>();
NotificationPreferences
=
new
List
<
EnforcementLev
el
>();
NotificationPreferences
=
new
List
<
NotificationOptionViewMod
el
>();
}
private
SymbolSpecification
_selectedSpecification
;
private
NamingStyle
_selectedNamingStyle
;
private
EnforcementLev
el
_selectedNotification
;
private
NotificationOptionViewMod
el
_selectedNotification
;
public
ObservableCollection
<
SymbolSpecification
>
Specifications
{
get
;
set
;
}
public
ObservableCollection
<
NamingStyle
>
NamingStyles
{
get
;
set
;
}
public
IEnumerable
<
EnforcementLev
el
>
NotificationPreferences
{
get
;
set
;
}
public
IEnumerable
<
NotificationOptionViewMod
el
>
NotificationPreferences
{
get
;
set
;
}
public
SymbolSpecification
SelectedSpecification
{
...
...
@@ -230,7 +232,7 @@ public NamingStyle SelectedStyle
SetProperty
(
ref
_selectedNamingStyle
,
value
);
}
}
public
EnforcementLev
el
SelectedNotificationPreference
public
NotificationOptionViewMod
el
SelectedNotificationPreference
{
get
{
...
...
src/VisualStudio/Core/Impl/ServicesVisualStudioImpl.csproj
浏览文件 @
510b6e05
...
...
@@ -256,7 +256,6 @@
<Compile
Include=
"Options\Style\NamingPreferences\NamingStyleOptionPageControl.xaml.cs"
>
<DependentUpon>
NamingStyleOptionPageControl.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"Options\Style\NamingPreferences\EnforcementLevel.cs"
/>
<Compile
Include=
"Options\Style\NamingPreferences\NamingStyleOptionPageViewModel.cs"
/>
<Compile
Include=
"Options\Style\NamingPreferences\SymbolSpecification\SymbolSpecificationDialog.xaml.cs"
>
<DependentUpon>
SymbolSpecificationDialog.xaml
</DependentUpon>
...
...
src/Workspaces/Core/Portable/CodeStyle/NotificationOption.cs
浏览文件 @
510b6e05
...
...
@@ -16,10 +16,10 @@ public class NotificationOption
public
DiagnosticSeverity
Value
{
get
;
set
;
}
public
static
readonly
NotificationOption
None
=
new
NotificationOption
(
nameof
(
None
)
,
DiagnosticSeverity
.
Hidden
);
public
static
readonly
NotificationOption
Suggestion
=
new
NotificationOption
(
nameof
(
Suggestion
)
,
DiagnosticSeverity
.
Info
);
public
static
readonly
NotificationOption
Warning
=
new
NotificationOption
(
nameof
(
Warning
)
,
DiagnosticSeverity
.
Warning
);
public
static
readonly
NotificationOption
Error
=
new
NotificationOption
(
nameof
(
Error
)
,
DiagnosticSeverity
.
Error
);
public
static
readonly
NotificationOption
None
=
new
NotificationOption
(
WorkspacesResources
.
None
,
DiagnosticSeverity
.
Hidden
);
public
static
readonly
NotificationOption
Suggestion
=
new
NotificationOption
(
WorkspacesResources
.
Suggestion
,
DiagnosticSeverity
.
Info
);
public
static
readonly
NotificationOption
Warning
=
new
NotificationOption
(
WorkspacesResources
.
Warning
,
DiagnosticSeverity
.
Warning
);
public
static
readonly
NotificationOption
Error
=
new
NotificationOption
(
WorkspacesResources
.
Error
,
DiagnosticSeverity
.
Error
);
private
NotificationOption
(
string
name
,
DiagnosticSeverity
severity
)
{
...
...
src/Workspaces/Core/Portable/WorkspacesResources.Designer.cs
浏览文件 @
510b6e05
...
...
@@ -620,6 +620,15 @@ internal class WorkspacesResources {
}
}
/// <summary>
/// Looks up a localized string similar to Error.
/// </summary>
internal
static
string
Error
{
get
{
return
ResourceManager
.
GetString
(
"Error"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Event.
/// </summary>
...
...
@@ -909,21 +918,30 @@ internal class WorkspacesResources {
}
/// <summary>
/// Looks up a localized string similar to
Option '{0}' has an unsupported type to use with {1}. You should specify a parsing function.
.
/// Looks up a localized string similar to
Non-Field Members
.
/// </summary>
internal
static
string
Option_0_has_an_unsupported_type_to_use_with_1_You_should_specify_a_parsing_function
{
internal
static
string
Non_Field_Members
{
get
{
return
ResourceManager
.
GetString
(
"Option_0_has_an_unsupported_type_to_use_with_1_You_should_specify_a_parsing_funct"
+
"ion"
,
resourceCulture
);
return
ResourceManager
.
GetString
(
"Non_Field_Members"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Non
-Field Members
.
/// Looks up a localized string similar to Non
e
.
/// </summary>
internal
static
string
Non
_Field_Members
{
internal
static
string
Non
e
{
get
{
return
ResourceManager
.
GetString
(
"Non_Field_Members"
,
resourceCulture
);
return
ResourceManager
.
GetString
(
"None"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Option '{0}' has an unsupported type to use with {1}. You should specify a parsing function..
/// </summary>
internal
static
string
Option_0_has_an_unsupported_type_to_use_with_1_You_should_specify_a_parsing_function
{
get
{
return
ResourceManager
.
GetString
(
"Option_0_has_an_unsupported_type_to_use_with_1_You_should_specify_a_parsing_funct"
+
"ion"
,
resourceCulture
);
}
}
...
...
@@ -1144,6 +1162,15 @@ internal class WorkspacesResources {
}
}
/// <summary>
/// Looks up a localized string similar to Suggestion.
/// </summary>
internal
static
string
Suggestion
{
get
{
return
ResourceManager
.
GetString
(
"Suggestion"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Supplied diagnostic cannot be null..
/// </summary>
...
...
src/Workspaces/Core/Portable/WorkspacesResources.resx
浏览文件 @
510b6e05
...
...
@@ -575,4 +575,13 @@
<value>
Method
</value>
<comment>
{locked:method} unless the capitalization should be handled differently
</comment>
</data>
<data
name=
"Error"
xml:space=
"preserve"
>
<value>
Error
</value>
</data>
<data
name=
"None"
xml:space=
"preserve"
>
<value>
None
</value>
</data>
<data
name=
"Suggestion"
xml:space=
"preserve"
>
<value>
Suggestion
</value>
</data>
</root>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录