Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
a7a631f2
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,发现更多精彩内容 >>
提交
a7a631f2
编写于
5月 02, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add UI options for configuring 'add using'
上级
8d5c08d0
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
108 addition
and
37 deletion
+108
-37
src/Features/Core/Portable/Features.csproj
src/Features/Core/Portable/Features.csproj
+2
-1
src/Features/Core/Portable/Shared/Options/AddImportOptions.cs
...Features/Core/Portable/Shared/Options/AddImportOptions.cs
+15
-0
src/Features/Core/Portable/Shared/Options/AddImportOptionsProvider.cs
.../Core/Portable/Shared/Options/AddImportOptionsProvider.cs
+21
-0
src/Features/Core/Portable/Shared/Options/OrganizerOptions.cs
...Features/Core/Portable/Shared/Options/OrganizerOptions.cs
+0
-8
src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs
src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs
+27
-9
src/VisualStudio/CSharp/Impl/CSharpVSResources.resx
src/VisualStudio/CSharp/Impl/CSharpVSResources.resx
+8
-2
src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml
...Studio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml
+14
-8
src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs
...alStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs
+8
-2
src/VisualStudio/CSharp/Impl/Options/AutomationObject.cs
src/VisualStudio/CSharp/Impl/Options/AutomationObject.cs
+12
-6
src/VisualStudio/CSharp/Impl/Options/CSharpSettingsManagerOptionSerializer.cs
...arp/Impl/Options/CSharpSettingsManagerOptionSerializer.cs
+1
-1
未找到文件。
src/Features/Core/Portable/Features.csproj
浏览文件 @
a7a631f2
...
...
@@ -281,8 +281,9 @@
<Compile
Include=
"RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsService.cs"
/>
<Compile
Include=
"ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs"
/>
<Compile
Include=
"ReplaceMethodWithProperty\IReplaceMethodWithPropertyService.cs"
/>
<Compile
Include=
"Shared\Options\AddImportOptionsProvider.cs"
/>
<Compile
Include=
"Shared\Extensions\ProjectExtensions.cs"
/>
<Compile
Include=
"Shared\Options\
OrganizerOptionsProvider
.cs"
/>
<Compile
Include=
"Shared\Options\
AddImportOptions
.cs"
/>
<Compile
Include=
"Shared\Options\RuntimeOptions.cs"
/>
<Compile
Include=
"Shared\Options\RuntimeOptionsProvider.cs"
/>
<Compile
Include=
"Shared\Options\ServiceComponentOnOffOptionsProvider.cs"
/>
...
...
src/Features/Core/Portable/Shared/Options/AddImportOptions.cs
0 → 100644
浏览文件 @
a7a631f2
using
Microsoft.CodeAnalysis.Options
;
namespace
Microsoft.CodeAnalysis.Shared.Options
{
internal
class
AddImportOptions
{
public
const
string
FeatureName
=
"AddImport"
;
public
static
PerLanguageOption
<
bool
>
OfferForTypesFromNetReferenceAssemblies
=
new
PerLanguageOption
<
bool
>(
FeatureName
,
nameof
(
OfferForTypesFromNetReferenceAssemblies
),
defaultValue
:
false
);
public
static
PerLanguageOption
<
bool
>
OfferForTypesFromNugetOrgPackages
=
new
PerLanguageOption
<
bool
>(
FeatureName
,
nameof
(
OfferForTypesFromNugetOrgPackages
),
defaultValue
:
false
);
}
}
src/Features/Core/Portable/Shared/Options/
Organizer
OptionsProvider.cs
→
src/Features/Core/Portable/Shared/Options/
AddImport
OptionsProvider.cs
浏览文件 @
a7a631f2
// 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
Microsoft.CodeAnalysis.Options
;
using
Microsoft.CodeAnalysis.Options.Providers
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.Composition
;
using
Microsoft.CodeAnalysis.Options
;
using
Microsoft.CodeAnalysis.Options.Providers
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Microsoft.CodeAnalysis.Shared.Options
{
[
ExportOptionProvider
,
Shared
]
internal
class
Organizer
OptionsProvider
:
IOptionProvider
internal
class
AddImport
OptionsProvider
:
IOptionProvider
{
private
readonly
IEnumerable
<
IOption
>
_options
=
new
List
<
IOption
>
{
OrganizerOptions
.
WarnOnBuildErrors
}.
ToImmutableArray
();
private
readonly
IEnumerable
<
IOption
>
_options
=
ImmutableArray
.
Create
<
IOption
>(
AddImportOptions
.
OfferForTypesFromNetReferenceAssemblies
);
public
IEnumerable
<
IOption
>
GetOptions
()
{
return
_options
;
}
public
IEnumerable
<
IOption
>
GetOptions
()
=>
_options
;
}
}
src/Features/Core/Portable/Shared/Options/OrganizerOptions.cs
浏览文件 @
a7a631f2
...
...
@@ -13,13 +13,5 @@ public static PerLanguageOption<bool> PlaceSystemNamespaceFirst
{
get
{
return
Editing
.
GenerationOptions
.
PlaceSystemNamespaceFirst
;
}
}
/// <summary>
/// This option is currently unused by Roslyn, but we might want to implement it in the
/// future. Keeping the option while it's unimplemented allows all upgrade paths to
/// maintain any customized value for this setting, even through versions that have not
/// implemented this feature yet.
/// </summary>
public
static
readonly
PerLanguageOption
<
bool
>
WarnOnBuildErrors
=
new
PerLanguageOption
<
bool
>(
FeatureName
,
"WarnOnBuildErrors"
,
defaultValue
:
true
);
}
}
src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs
浏览文件 @
a7a631f2
...
...
@@ -366,6 +366,15 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Add 'using'.
/// </summary>
internal
static
string
Option_Add_using
{
get
{
return
ResourceManager
.
GetString
(
"Option_Add_using"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to _Move local declaration to the extracted method if it is not used elsewhere.
/// </summary>
...
...
@@ -501,6 +510,24 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Offer to add 'using' for types from .Net reference assemblies.
/// </summary>
internal
static
string
Option_Offer_to_add_using_for_types_from_Net_reference_assemblies
{
get
{
return
ResourceManager
.
GetString
(
"Option_Offer_to_add_using_for_types_from_Net_reference_assemblies"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Offer to add 'using' for types from Nuget.org packages.
/// </summary>
internal
static
string
Option_Offer_to_add_using_for_types_from_Nuget_org_packages
{
get
{
return
ResourceManager
.
GetString
(
"Option_Offer_to_add_using_for_types_from_Nuget_org_packages"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Optimize for solution size.
/// </summary>
...
...
@@ -537,15 +564,6 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Organize Usings.
/// </summary>
internal
static
string
Option_OrganizeUsings
{
get
{
return
ResourceManager
.
GetString
(
"Option_OrganizeUsings"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Outlining.
/// </summary>
...
...
src/VisualStudio/CSharp/Impl/CSharpVSResources.resx
浏览文件 @
a7a631f2
...
...
@@ -369,8 +369,8 @@
<data
name=
"Option_OptimizeForSolutionSize_Small"
xml:space=
"preserve"
>
<value>
Small
</value>
</data>
<data
name=
"Option_
OrganizeUsings
"
xml:space=
"preserve"
>
<value>
Organize Usings
</value>
<data
name=
"Option_
Add_using
"
xml:space=
"preserve"
>
<value>
Add 'using'
</value>
</data>
<data
name=
"Option_Outlining"
xml:space=
"preserve"
>
<value>
Outlining
</value>
...
...
@@ -408,4 +408,10 @@
<data
name=
"NewLinesForBracesProperty"
xml:space=
"preserve"
>
<value>
Place open brace on new line for properties, indexers, and events
</value>
</data>
<data
name=
"Option_Offer_to_add_using_for_types_from_Net_reference_assemblies"
xml:space=
"preserve"
>
<value>
Offer to add 'using' for types from .Net reference assemblies
</value>
</data>
<data
name=
"Option_Offer_to_add_using_for_types_from_Nuget_org_packages"
xml:space=
"preserve"
>
<value>
Offer to add 'using' for types from Nuget.org packages
</value>
</data>
</root>
\ No newline at end of file
src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml
浏览文件 @
a7a631f2
...
...
@@ -11,6 +11,20 @@
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel>
<GroupBox x:Uid="AddUsingGroupBox"
Header="{x:Static local:AdvancedOptionPageStrings.Option_Add_using}">
<StackPanel>
<CheckBox x:Name="PlaceSystemNamespaceFirst"
x:Uid="SortUsings_PlaceSystemFirst"
Content="{x:Static local:AdvancedOptionPageStrings.Option_PlaceSystemNamespaceFirst}" />
<CheckBox x:Name="OfferForTypesFromNetReferenceAssembly"
x:Uid="AddImport_OfferForTypesFromNetReferenceAssemblies"
Content="{x:Static local:AdvancedOptionPageStrings.Option_Offer_to_add_using_for_types_from_Net_reference_assemblies}" />
<CheckBox x:Name="OfferForTypesFromNugetOrgPackages"
x:Uid="AddImport_OfferForTypesFromNugetOrgPackages"
Content="{x:Static local:AdvancedOptionPageStrings.Option_Offer_to_add_using_for_types_from_Nuget_org_packages}" />
</StackPanel>
</GroupBox>
<GroupBox x:Uid="HighlightingGroupBox"
Header="{x:Static local:AdvancedOptionPageStrings.Option_Highlighting}">
<StackPanel>
...
...
@@ -42,14 +56,6 @@
Content="{x:Static local:AdvancedOptionPageStrings.Option_RenameTrackingPreview}" />
</StackPanel>
</GroupBox>
<GroupBox x:Uid="OrganizeUsingsGroupBox"
Header="{x:Static local:AdvancedOptionPageStrings.Option_OrganizeUsings}">
<StackPanel>
<CheckBox x:Name="PlaceSystemNamespaceFirst"
x:Uid="SortUsings_PlaceSystemFirst"
Content="{x:Static local:AdvancedOptionPageStrings.Option_PlaceSystemNamespaceFirst}" />
</StackPanel>
</GroupBox>
<GroupBox x:Uid="ExtractMethodGroupBox"
Header="{x:Static local:AdvancedOptionPageStrings.Option_ExtractMethod}">
<StackPanel>
...
...
src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs
浏览文件 @
a7a631f2
...
...
@@ -89,9 +89,9 @@ public static string Option_OptimizeForSolutionSize_Small
get
{
return
CSharpVSResources
.
Option_OptimizeForSolutionSize_Small
;
}
}
public
static
string
Option_
OrganizeUsings
public
static
string
Option_
Add_using
{
get
{
return
CSharpVSResources
.
Option_
OrganizeUsings
;
}
get
{
return
CSharpVSResources
.
Option_
Add_using
;
}
}
public
static
string
Option_Outlining
...
...
@@ -108,5 +108,11 @@ public static string Option_PlaceSystemNamespaceFirst
{
get
{
return
CSharpVSResources
.
Option_PlaceSystemNamespaceFirst
;
}
}
public
static
string
Option_Offer_to_add_using_for_types_from_Net_reference_assemblies
=>
CSharpVSResources
.
Option_Offer_to_add_using_for_types_from_Net_reference_assemblies
;
public
static
string
Option_Offer_to_add_using_for_types_from_Nuget_org_packages
=>
CSharpVSResources
.
Option_Offer_to_add_using_for_types_from_Nuget_org_packages
;
}
}
src/VisualStudio/CSharp/Impl/Options/AutomationObject.cs
浏览文件 @
a7a631f2
...
...
@@ -300,6 +300,18 @@ public int SortUsings_PlaceSystemFirst
set
{
SetBooleanOption
(
OrganizerOptions
.
PlaceSystemNamespaceFirst
,
value
);
}
}
public
int
AddImport_OfferForTypesFromNetReferenceAssemblies
{
get
{
return
GetBooleanOption
(
AddImportOptions
.
OfferForTypesFromNetReferenceAssemblies
);
}
set
{
SetBooleanOption
(
AddImportOptions
.
OfferForTypesFromNetReferenceAssemblies
,
value
);
}
}
public
int
AddImport_OfferForTypesFromNugetOrgPackages
{
get
{
return
GetBooleanOption
(
AddImportOptions
.
OfferForTypesFromNugetOrgPackages
);
}
set
{
SetBooleanOption
(
AddImportOptions
.
OfferForTypesFromNugetOrgPackages
,
value
);
}
}
public
int
Space_AfterBasesColon
{
get
{
return
GetBooleanOption
(
CSharpFormattingOptions
.
SpaceAfterColonInBaseTypeDeclaration
);
}
...
...
@@ -473,12 +485,6 @@ public int Style_UseVarWhenDeclaringLocals
set
{
SetBooleanOption
(
CSharpCodeStyleOptions
.
UseVarWhenDeclaringLocals
,
value
);
}
}
public
int
WarnOnBuildErrors
{
get
{
return
GetBooleanOption
(
OrganizerOptions
.
WarnOnBuildErrors
);
}
set
{
SetBooleanOption
(
OrganizerOptions
.
WarnOnBuildErrors
,
value
);
}
}
public
int
Wrapping_IgnoreSpacesAroundBinaryOperators
{
get
...
...
src/VisualStudio/CSharp/Impl/Options/CSharpSettingsManagerOptionSerializer.cs
浏览文件 @
a7a631f2
...
...
@@ -120,7 +120,7 @@ protected override string GetStorageKeyForOption(IOption option)
protected
override
bool
SupportsOption
(
IOption
option
,
string
languageName
)
{
if
(
option
==
OrganizerOptions
.
PlaceSystemNamespaceFirst
||
option
==
OrganizerOptions
.
WarnOnBuildError
s
||
option
==
AddImportOptions
.
OfferForTypesFromNetReferenceAssemblie
s
||
option
==
CSharpCompletionOptions
.
AddNewLineOnEnterAfterFullyTypedWord
||
option
==
CSharpCompletionOptions
.
IncludeSnippets
||
option
.
Feature
==
CSharpCodeStyleOptions
.
FeatureName
||
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录