Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
ee0a9fe6
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,发现更多精彩内容 >>
提交
ee0a9fe6
编写于
9月 18, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename feature to 'Use throw expressoin.'
上级
9c2115fb
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
62 addition
and
63 deletion
+62
-63
src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj
...EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj
+2
-2
src/EditorFeatures/CSharpTest/UseThrowExpression/UseThrowExpressionTests.cs
.../CSharpTest/UseThrowExpression/UseThrowExpressionTests.cs
+15
-15
src/EditorFeatures/CSharpTest/UseThrowExpression/UseThrowExpressionTests_FixAllTests.cs
...UseThrowExpression/UseThrowExpressionTests_FixAllTests.cs
+6
-7
src/Features/CSharp/Portable/CSharpFeatures.csproj
src/Features/CSharp/Portable/CSharpFeatures.csproj
+1
-1
src/Features/CSharp/Portable/UseThrowExpression/CSharpUseThrowExpressionDiagnosticAnalyzer.cs
...wExpression/CSharpUseThrowExpressionDiagnosticAnalyzer.cs
+3
-3
src/Features/Core/Portable/CodeFixes/PredefinedCodeFixProviderNames.cs
...Core/Portable/CodeFixes/PredefinedCodeFixProviderNames.cs
+1
-1
src/Features/Core/Portable/Diagnostics/Analyzers/IDEDiagnosticIds.cs
...s/Core/Portable/Diagnostics/Analyzers/IDEDiagnosticIds.cs
+1
-1
src/Features/Core/Portable/Features.csproj
src/Features/Core/Portable/Features.csproj
+3
-3
src/Features/Core/Portable/FeaturesResources.Designer.cs
src/Features/Core/Portable/FeaturesResources.Designer.cs
+9
-9
src/Features/Core/Portable/FeaturesResources.resx
src/Features/Core/Portable/FeaturesResources.resx
+2
-2
src/Features/Core/Portable/UseThrowExpression/AbstractUseThrowExpressionDiagnosticAnalyzer.cs
...xpression/AbstractUseThrowExpressionDiagnosticAnalyzer.cs
+7
-7
src/Features/Core/Portable/UseThrowExpression/UseThrowExpressionCodeFixProvider.FixAllProvider.cs
...ssion/UseThrowExpressionCodeFixProvider.FixAllProvider.cs
+6
-6
src/Features/Core/Portable/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs
...e/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs
+6
-6
未找到文件。
src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj
浏览文件 @
ee0a9fe6
...
...
@@ -309,8 +309,8 @@
<Compile
Include=
"Organizing\OrganizeModifiersTests.cs"
/>
<Compile
Include=
"Organizing\OrganizeTypeDeclarationTests.cs"
/>
<Compile
Include=
"Organizing\OrganizeUsingsTests.cs"
/>
<Compile
Include=
"
SimplifyNullCheck\SimplifyNullCheck
Tests_FixAllTests.cs"
/>
<Compile
Include=
"
SimplifyNullCheck\SimplifyNullCheck
Tests.cs"
/>
<Compile
Include=
"
UseThrowExpression\UseThrowExpression
Tests_FixAllTests.cs"
/>
<Compile
Include=
"
UseThrowExpression\UseThrowExpression
Tests.cs"
/>
<Compile
Include=
"Structure\AbstractCSharpSyntaxNodeStructureTests.cs"
/>
<Compile
Include=
"Structure\AbstractCSharpSyntaxTriviaStructureTests.cs"
/>
<Compile
Include=
"Structure\AccessorDeclarationStructureTests.cs"
/>
...
...
src/EditorFeatures/CSharpTest/
SimplifyNullCheck/SimplifyNullCheck
Tests.cs
→
src/EditorFeatures/CSharpTest/
UseThrowExpression/UseThrowExpression
Tests.cs
浏览文件 @
ee0a9fe6
...
...
@@ -4,22 +4,22 @@
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.CodeFixes
;
using
Microsoft.CodeAnalysis.CSharp
;
using
Microsoft.CodeAnalysis.CSharp.
SimplifyNullCheck
;
using
Microsoft.CodeAnalysis.CSharp.
UseThrowExpression
;
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics
;
using
Microsoft.CodeAnalysis.
SimplifyNullCheck
;
using
Microsoft.CodeAnalysis.
UseThrowExpression
;
using
Roslyn.Test.Utilities
;
using
Xunit
;
namespace
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.
SimplifyNullCheck
namespace
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.
UseThrowExpression
{
public
partial
class
SimplifyNullCheck
Tests
:
AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
public
partial
class
UseThrowExpression
Tests
:
AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
internal
override
Tuple
<
DiagnosticAnalyzer
,
CodeFixProvider
>
CreateDiagnosticProviderAndFixer
(
Workspace
workspace
)
{
return
Tuple
.
Create
<
DiagnosticAnalyzer
,
CodeFixProvider
>(
new
CSharp
SimplifyNullCheck
DiagnosticAnalyzer
(),
new
SimplifyNullCheck
CodeFixProvider
());
new
CSharp
UseThrowExpression
DiagnosticAnalyzer
(),
new
UseThrowExpression
CodeFixProvider
());
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsSimplifyNullCheck
)]
...
...
@@ -33,7 +33,7 @@ class C
{
void M(string s)
{
[|if|] (s == null) throw
new ArgumentNullException(nameof(s));
if (s == null) [|throw|]
new ArgumentNullException(nameof(s));
_s = s;
}
}"
,
...
...
@@ -59,7 +59,7 @@ class C
{
void M(string s)
{
[|if|] (s == null) { throw
new ArgumentNullException(nameof(s)); }
if (s == null) { [|throw|]
new ArgumentNullException(nameof(s)); }
_s = s;
}
}"
,
...
...
@@ -102,7 +102,7 @@ class C
{
void M(string s)
{
[|if|] (s == null) { throw
new ArgumentNullException(nameof(s)) };
if (s == null) { [|throw|]
new ArgumentNullException(nameof(s)) };
_s = s;
}
}"
,
parseOptions
:
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
CSharp6
));
...
...
@@ -119,7 +119,7 @@ class C
{
void M(string s, string t)
{
[|if|] (s == null) { throw
new ArgumentNullException(nameof(s)); }
if (s == null) { [|throw|]
new ArgumentNullException(nameof(s)); }
if (t == null) { throw new ArgumentNullException(nameof(t)); }
_s = s;
}
...
...
@@ -147,7 +147,7 @@ class C
{
void M(string s, string t)
{
[|if|] (s == null) { throw
new ArgumentNullException(nameof(s)) };
if (s == null) { [|throw|]
new ArgumentNullException(nameof(s)) };
s = ""something"";
_s = s;
}
...
...
@@ -165,7 +165,7 @@ class C
{
void M(string s)
{
[|if|] (null == s) throw
new ArgumentNullException(nameof(s));
if (null == s) [|throw|]
new ArgumentNullException(nameof(s));
_s = s;
}
}"
,
...
...
@@ -192,7 +192,7 @@ class C
void M()
{
string s = null;
[|if|] (null == s) throw
new ArgumentNullException(nameof(s));
if (null == s) [|throw|]
new ArgumentNullException(nameof(s));
_s = s;
}
}"
,
...
...
@@ -221,7 +221,7 @@ class C
void M()
{
[|if|] (null == s) throw
new ArgumentNullException(nameof(s));
if (null == s) [|throw|]
new ArgumentNullException(nameof(s));
_s = s;
}
}"
);
...
...
@@ -239,7 +239,7 @@ class C
void M(string s)
{
_s = s;
[|if|] (s == null) throw
new ArgumentNullException(nameof(s));
if (s == null) [|throw|]
new ArgumentNullException(nameof(s));
}
}"
);
}
...
...
src/EditorFeatures/CSharpTest/
SimplifyNullCheck/SimplifyNullCheck
Tests_FixAllTests.cs
→
src/EditorFeatures/CSharpTest/
UseThrowExpression/UseThrowExpression
Tests_FixAllTests.cs
浏览文件 @
ee0a9fe6
...
...
@@ -2,13 +2,12 @@
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics
;
using
Microsoft.CodeAnalysis.SimplifyNullCheck
;
using
Roslyn.Test.Utilities
;
using
Xunit
;
namespace
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.
SimplifyNullCheck
namespace
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.
UseThrowExpression
{
public
partial
class
SimplifyNullCheck
Tests
:
AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
public
partial
class
UseThrowExpression
Tests
:
AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsSimplifyNullCheck
)]
public
async
Task
FixAllInDocument1
()
...
...
@@ -21,7 +20,7 @@ class C
{
void M(string s, string t)
{
{|FixAllInDocument:if|} (s == null) { throw
new ArgumentNullException(nameof(s)); }
if (s == null) { {|FixAllInDocument:throw|}
new ArgumentNullException(nameof(s)); }
if (t == null) { throw new ArgumentNullException(nameof(t)); }
_s = s;
_t = t;
...
...
@@ -52,7 +51,7 @@ class C
void M(string s, string t)
{
if (s == null) { throw new ArgumentNullException(nameof(s)); }
{|FixAllInDocument:if|} (t == null) { throw
new ArgumentNullException(nameof(t)); }
if (t == null) { {|FixAllInDocument:throw|}
new ArgumentNullException(nameof(t)); }
_s = s;
_t = t;
}
...
...
@@ -84,7 +83,7 @@ class C
{
void M(string s, string t)
{
{|FixAllInDocument:if|} (s == null) { throw
new ArgumentNullException(nameof(s)); }
if (s == null) { {|FixAllInDocument:throw|}
new ArgumentNullException(nameof(s)); }
_s = s;
}
}
...
...
@@ -148,7 +147,7 @@ class C
{
void M(string s, string t)
{
{|FixAllInProject:if|} (s == null) { throw
new ArgumentNullException(nameof(s)); }
if (s == null) { {|FixAllInProject:throw|}
new ArgumentNullException(nameof(s)); }
_s = s;
}
}
...
...
src/Features/CSharp/Portable/CSharpFeatures.csproj
浏览文件 @
ee0a9fe6
...
...
@@ -354,7 +354,7 @@
<Compile
Include=
"Organizing\Organizers\OperatorDeclarationOrganizer.cs"
/>
<Compile
Include=
"Organizing\Organizers\PropertyDeclarationOrganizer.cs"
/>
<Compile
Include=
"Organizing\Organizers\StructDeclarationOrganizer.cs"
/>
<Compile
Include=
"
SimplifyNullCheck\CSharpSimplifyNullCheck
DiagnosticAnalyzer.cs"
/>
<Compile
Include=
"
UseThrowExpression\CSharpUseThrowExpression
DiagnosticAnalyzer.cs"
/>
<Compile
Include=
"Structure\CSharpBlockStructureProvider.cs"
/>
<Compile
Include=
"Structure\CSharpStructureHelpers.cs"
/>
<Compile
Include=
"Structure\CSharpBlockStructureService.cs"
/>
...
...
src/Features/CSharp/Portable/
SimplifyNullCheck/CSharpSimplifyNullCheck
DiagnosticAnalyzer.cs
→
src/Features/CSharp/Portable/
UseThrowExpression/CSharpUseThrowExpression
DiagnosticAnalyzer.cs
浏览文件 @
ee0a9fe6
// 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.Diagnostics
;
using
Microsoft.CodeAnalysis.
SimplifyNullCheck
;
using
Microsoft.CodeAnalysis.
UseThrowExpression
;
namespace
Microsoft.CodeAnalysis.CSharp.
SimplifyNullCheck
namespace
Microsoft.CodeAnalysis.CSharp.
UseThrowExpression
{
[
DiagnosticAnalyzer
(
LanguageNames
.
CSharp
)]
internal
class
CSharp
SimplifyNullCheckDiagnosticAnalyzer
:
AbstractSimplifyNullCheck
DiagnosticAnalyzer
internal
class
CSharp
UseThrowExpressionDiagnosticAnalyzer
:
AbstractUseThrowExpression
DiagnosticAnalyzer
{
protected
override
bool
IsSupported
(
ParseOptions
options
)
{
...
...
src/Features/Core/Portable/CodeFixes/PredefinedCodeFixProviderNames.cs
浏览文件 @
ee0a9fe6
...
...
@@ -38,13 +38,13 @@ internal static class PredefinedCodeFixProviderNames
public
const
string
RemoveUnnecessaryImports
=
"Remove Unnecessary Usings or Imports"
;
public
const
string
RenameTracking
=
"Rename Tracking"
;
public
const
string
SimplifyNames
=
"Simplify Names"
;
public
const
string
SimplifyNullCheck
=
nameof
(
SimplifyNullCheck
);
public
const
string
SpellCheck
=
"Spell Check"
;
public
const
string
Suppression
=
nameof
(
Suppression
);
public
const
string
AddOverloads
=
"Add Overloads to member"
;
public
const
string
AddNew
=
"Add new keyword to member"
;
public
const
string
UseImplicitType
=
nameof
(
UseImplicitType
);
public
const
string
UseExplicitType
=
nameof
(
UseExplicitType
);
public
const
string
UseThrowExpression
=
nameof
(
UseThrowExpression
);
public
const
string
PreferFrameworkType
=
nameof
(
PreferFrameworkType
);
}
}
src/Features/Core/Portable/Diagnostics/Analyzers/IDEDiagnosticIds.cs
浏览文件 @
ee0a9fe6
...
...
@@ -19,7 +19,7 @@ internal static class IDEDiagnosticIds
public
const
string
PreferIntrinsicPredefinedTypeInMemberAccessDiagnosticId
=
"IDE0013"
;
public
const
string
PreferFrameworkTypeInDeclarationsDiagnosticId
=
"IDE0014"
;
public
const
string
PreferFrameworkTypeInMemberAccessDiagnosticId
=
"IDE0015"
;
public
const
string
SimplifyNullCheck
DiagnosticId
=
"IDE0016"
;
public
const
string
UseThrowExpression
DiagnosticId
=
"IDE0016"
;
// Analyzer error Ids
public
const
string
AnalyzerChangedId
=
"IDE1001"
;
...
...
src/Features/Core/Portable/Features.csproj
浏览文件 @
ee0a9fe6
...
...
@@ -92,9 +92,9 @@
</Compile>
<Compile
Include=
"AddMissingReference\AbstractAddMissingReferenceCodeFixProvider.cs"
/>
<Compile
Include=
"AddMissingReference\CodeAction.cs"
/>
<Compile
Include=
"
SimplifyNullCheck\AbstractSimplifyNullCheck
DiagnosticAnalyzer.cs"
/>
<Compile
Include=
"
SimplifyNullCheck\SimplifyNullCheck
CodeFixProvider.cs"
/>
<Compile
Include=
"
SimplifyNullCheck\SimplifyNullCheck
CodeFixProvider.FixAllProvider.cs"
/>
<Compile
Include=
"
UseThrowExpression\AbstractUseThrowExpression
DiagnosticAnalyzer.cs"
/>
<Compile
Include=
"
UseThrowExpression\UseThrowExpression
CodeFixProvider.cs"
/>
<Compile
Include=
"
UseThrowExpression\UseThrowExpression
CodeFixProvider.FixAllProvider.cs"
/>
<Compile
Include=
"Structure\BlockTypes.cs"
/>
<Compile
Include=
"CodeLens\CodeLensReferencesServiceFactory.cs"
/>
<Compile
Include=
"Structure\Syntax\BlockStructureExtensions.cs"
/>
...
...
src/Features/Core/Portable/FeaturesResources.Designer.cs
浏览文件 @
ee0a9fe6
...
...
@@ -2331,15 +2331,6 @@ internal class FeaturesResources {
}
}
/// <summary>
/// Looks up a localized string similar to Simplify null check.
/// </summary>
internal
static
string
Simplify_null_check
{
get
{
return
ResourceManager
.
GetString
(
"Simplify_null_check"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Solution.
/// </summary>
...
...
@@ -2894,6 +2885,15 @@ internal class FeaturesResources {
}
}
/// <summary>
/// Looks up a localized string similar to Use 'throw' expression.
/// </summary>
internal
static
string
Use_throw_expression
{
get
{
return
ResourceManager
.
GetString
(
"Use_throw_expression"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to User Diagnostic Analyzer Failure..
/// </summary>
...
...
src/Features/Core/Portable/FeaturesResources.resx
浏览文件 @
ee0a9fe6
...
...
@@ -1067,7 +1067,7 @@ This version used in: {2}</value>
<data
name=
"Install_package_0"
xml:space=
"preserve"
>
<value>
Install package '{0}'
</value>
</data>
<data
name=
"
Simplify_null_check
"
xml:space=
"preserve"
>
<value>
Simplify null check
</value>
<data
name=
"
Use_throw_expression
"
xml:space=
"preserve"
>
<value>
Use 'throw' expression
</value>
</data>
</root>
\ No newline at end of file
src/Features/Core/Portable/
SimplifyNullCheck/AbstractSimplifyNullCheck
DiagnosticAnalyzer.cs
→
src/Features/Core/Portable/
UseThrowExpression/AbstractUseThrowExpression
DiagnosticAnalyzer.cs
浏览文件 @
ee0a9fe6
...
...
@@ -9,7 +9,7 @@
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Semantics
;
namespace
Microsoft.CodeAnalysis.
SimplifyNullCheck
namespace
Microsoft.CodeAnalysis.
UseThrowExpression
{
/// <summary>
/// Looks for patterns of the form:
...
...
@@ -30,13 +30,13 @@ namespace Microsoft.CodeAnalysis.SimplifyNullCheck
/// Note: this analyzer can be udpated to run on VB once VB supports 'throw'
/// expressions as well.
/// </summary>
internal
abstract
class
Abstract
SimplifyNullCheck
DiagnosticAnalyzer
:
DiagnosticAnalyzer
,
IBuiltInAnalyzer
internal
abstract
class
Abstract
UseThrowExpression
DiagnosticAnalyzer
:
DiagnosticAnalyzer
,
IBuiltInAnalyzer
{
private
static
readonly
LocalizableString
s_localizableTitle
=
new
LocalizableResourceString
(
nameof
(
FeaturesResources
.
Simplify_null_check
),
FeaturesResources
.
ResourceManager
,
typeof
(
FeaturesResources
));
private
static
readonly
LocalizableString
s_localizableMessage
=
new
LocalizableResourceString
(
nameof
(
FeaturesResources
.
Simplify_null_check
),
WorkspacesResources
.
ResourceManager
,
typeof
(
Workspac
esResources
));
private
static
readonly
LocalizableString
s_localizableTitle
=
new
LocalizableResourceString
(
nameof
(
FeaturesResources
.
Use_throw_expression
),
FeaturesResources
.
ResourceManager
,
typeof
(
FeaturesResources
));
private
static
readonly
LocalizableString
s_localizableMessage
=
new
LocalizableResourceString
(
nameof
(
FeaturesResources
.
Use_throw_expression
),
FeaturesResources
.
ResourceManager
,
typeof
(
Featur
esResources
));
private
static
DiagnosticDescriptor
s_descriptor
=
new
DiagnosticDescriptor
(
IDEDiagnosticIds
.
SimplifyNullCheck
DiagnosticId
,
IDEDiagnosticIds
.
UseThrowExpression
DiagnosticId
,
s_localizableTitle
,
s_localizableMessage
,
DiagnosticCategory
.
Style
,
...
...
@@ -139,7 +139,7 @@ private void AnalyzeOperation(OperationAnalysisContext context)
assignmentExpression
.
Value
.
Syntax
.
GetLocation
());
var
descriptor
=
new
DiagnosticDescriptor
(
IDEDiagnosticIds
.
SimplifyNullCheck
DiagnosticId
,
IDEDiagnosticIds
.
UseThrowExpression
DiagnosticId
,
s_localizableTitle
,
s_localizableMessage
,
DiagnosticCategory
.
Style
,
...
...
@@ -147,7 +147,7 @@ private void AnalyzeOperation(OperationAnalysisContext context)
isEnabledByDefault
:
true
);
context
.
ReportDiagnostic
(
Diagnostic
.
Create
(
descriptor
,
ifOperation
.
Syntax
.
GetLocation
(),
additionalLocations
:
allLocations
));
Diagnostic
.
Create
(
descriptor
,
throwStatement
.
GetLocation
(),
additionalLocations
:
allLocations
));
}
private
bool
TryFindAssignmentExpression
(
...
...
src/Features/Core/Portable/
SimplifyNullCheck/SimplifyNullCheck
CodeFixProvider.FixAllProvider.cs
→
src/Features/Core/Portable/
UseThrowExpression/UseThrowExpression
CodeFixProvider.FixAllProvider.cs
浏览文件 @
ee0a9fe6
...
...
@@ -7,9 +7,9 @@
using
Microsoft.CodeAnalysis.CodeActions
;
using
Microsoft.CodeAnalysis.CodeFixes
;
namespace
Microsoft.CodeAnalysis.
SimplifyNullCheck
namespace
Microsoft.CodeAnalysis.
UseThrowExpression
{
internal
partial
class
SimplifyNullCheck
CodeFixProvider
internal
partial
class
UseThrowExpression
CodeFixProvider
{
/// <summary>
/// A specialized <see cref="FixAllProvider"/> for this CodeFixProvider.
...
...
@@ -34,15 +34,15 @@ internal partial class SimplifyNullCheckCodeFixProvider
///
/// This FixAllProvider avoids this entirely by not doing any textual merging.
/// Instead, we just take all the fixes to apply in the document, as we use
/// the core <see cref="
SimplifyNullCheck
CodeFixProvider.FixAllAsync"/> to do
/// the core <see cref="
UseThrowExpression
CodeFixProvider.FixAllAsync"/> to do
/// all the editing at once on the SyntaxTree. Because we're doing real tree
/// edits with actual nodes, there is no issue with anything getting messed up.
/// </summary>
private
class
SimplifyNullCheck
FixAllProvider
:
BatchFixAllProvider
private
class
UseThrowExpression
FixAllProvider
:
BatchFixAllProvider
{
private
readonly
SimplifyNullCheck
CodeFixProvider
_provider
;
private
readonly
UseThrowExpression
CodeFixProvider
_provider
;
public
SimplifyNullCheckFixAllProvider
(
SimplifyNullCheck
CodeFixProvider
provider
)
public
UseThrowExpressionFixAllProvider
(
UseThrowExpression
CodeFixProvider
provider
)
{
_provider
=
provider
;
}
...
...
src/Features/Core/Portable/
SimplifyNullCheck/SimplifyNullCheck
CodeFixProvider.cs
→
src/Features/Core/Portable/
UseThrowExpression/UseThrowExpression
CodeFixProvider.cs
浏览文件 @
ee0a9fe6
...
...
@@ -13,17 +13,17 @@
using
Microsoft.CodeAnalysis.Editing
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.
SimplifyNullCheck
namespace
Microsoft.CodeAnalysis.
UseThrowExpression
{
[
ExportCodeFixProvider
(
LanguageNames
.
CSharp
,
Name
=
PredefinedCodeFixProviderNames
.
SimplifyNullCheck
),
Shared
]
internal
partial
class
SimplifyNullCheck
CodeFixProvider
:
CodeFixProvider
Name
=
PredefinedCodeFixProviderNames
.
UseThrowExpression
),
Shared
]
internal
partial
class
UseThrowExpression
CodeFixProvider
:
CodeFixProvider
{
public
override
ImmutableArray
<
string
>
FixableDiagnosticIds
=>
ImmutableArray
.
Create
(
IDEDiagnosticIds
.
SimplifyNullCheck
DiagnosticId
);
=>
ImmutableArray
.
Create
(
IDEDiagnosticIds
.
UseThrowExpression
DiagnosticId
);
public
override
FixAllProvider
GetFixAllProvider
()
=>
new
SimplifyNullCheck
FixAllProvider
(
this
);
=>
new
UseThrowExpression
FixAllProvider
(
this
);
public
override
Task
RegisterCodeFixesAsync
(
CodeFixContext
context
)
{
...
...
@@ -76,7 +76,7 @@ private class MyCodeAction : CodeAction.DocumentChangeAction
{
public
MyCodeAction
(
Func
<
CancellationToken
,
Task
<
Document
>>
createChangedDocument
)
:
base
(
FeaturesResources
.
Simplify_null_check
,
createChangedDocument
)
:
base
(
FeaturesResources
.
Use_throw_expression
,
createChangedDocument
)
{
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录