Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
9cf48870
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,发现更多精彩内容 >>
提交
9cf48870
编写于
1月 11, 2017
作者:
S
Stefan Nikolei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Changes cause of review
上级
12fb3ca9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
9 deletion
+25
-9
src/EditorFeatures/CSharpTest/Diagnostics/RemoveUnusedVariable/RemoveUnusedVariableTest.cs
...gnostics/RemoveUnusedVariable/RemoveUnusedVariableTest.cs
+19
-0
src/Features/Core/Portable/CodeFixes/RemoveUnusedVariable/AbstractRemoveUnusedVariableCodeFixProvider.cs
...edVariable/AbstractRemoveUnusedVariableCodeFixProvider.cs
+1
-3
src/Features/Core/Portable/FeaturesResources.Designer.cs
src/Features/Core/Portable/FeaturesResources.Designer.cs
+2
-2
src/Features/Core/Portable/FeaturesResources.resx
src/Features/Core/Portable/FeaturesResources.resx
+1
-1
src/Features/VisualBasic/Portable/CodeFixes/RemoveUnusedVariable/RemoveUnusedVariableCodeFixProvider.vb
...moveUnusedVariable/RemoveUnusedVariableCodeFixProvider.vb
+2
-3
未找到文件。
src/EditorFeatures/CSharpTest/Diagnostics/RemoveUnusedVariable/RemoveUnusedVariableTest.cs
浏览文件 @
9cf48870
...
@@ -151,6 +151,25 @@ void Method()
...
@@ -151,6 +151,25 @@ void Method()
}
}
}"
,
}"
,
@"class Class
@"class Class
{
void Method()
{
}
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedVariable
)]
public
async
Task
RemoveUnusedVariableFixAll2
()
{
await
TestAsync
(
@"class Class
{
void Method()
{
string a, {|FixAllInDocument:b|};
}
}"
,
@"class Class
{
{
void Method()
void Method()
{
{
...
...
src/Features/Core/Portable/CodeFixes/RemoveUnusedVariable/AbstractRemoveUnusedVariableCodeFixProvider.cs
浏览文件 @
9cf48870
...
@@ -34,8 +34,6 @@ public async override Task RegisterCodeFixesAsync(CodeFixContext context)
...
@@ -34,8 +34,6 @@ public async override Task RegisterCodeFixesAsync(CodeFixContext context)
context
.
RegisterCodeFix
(
context
.
RegisterCodeFix
(
new
MyCodeAction
(
c
=>
FixAsync
(
context
.
Document
,
context
.
Diagnostics
.
First
(),
c
)),
new
MyCodeAction
(
c
=>
FixAsync
(
context
.
Document
,
context
.
Diagnostics
.
First
(),
c
)),
context
.
Diagnostics
);
context
.
Diagnostics
);
return
;
}
}
protected
override
Task
FixAllAsync
(
Document
document
,
ImmutableArray
<
Diagnostic
>
diagnostics
,
SyntaxEditor
editor
,
CancellationToken
cancellationToken
)
protected
override
Task
FixAllAsync
(
Document
document
,
ImmutableArray
<
Diagnostic
>
diagnostics
,
SyntaxEditor
editor
,
CancellationToken
cancellationToken
)
...
@@ -63,7 +61,7 @@ protected override Task FixAllAsync(Document document, ImmutableArray<Diagnostic
...
@@ -63,7 +61,7 @@ protected override Task FixAllAsync(Document document, ImmutableArray<Diagnostic
private
class
MyCodeAction
:
CodeAction
.
DocumentChangeAction
private
class
MyCodeAction
:
CodeAction
.
DocumentChangeAction
{
{
public
MyCodeAction
(
Func
<
CancellationToken
,
Task
<
Document
>>
createChangedDocument
)
:
public
MyCodeAction
(
Func
<
CancellationToken
,
Task
<
Document
>>
createChangedDocument
)
:
base
(
FeaturesResources
.
Remove_
Unused_Variable
,
createChangedDocument
,
FeaturesResources
.
Remove_Unused_V
ariable
)
base
(
FeaturesResources
.
Remove_
unused_variable
,
createChangedDocument
,
FeaturesResources
.
Remove_unused_v
ariable
)
{
{
}
}
}
}
...
...
src/Features/Core/Portable/FeaturesResources.Designer.cs
浏览文件 @
9cf48870
...
@@ -2277,9 +2277,9 @@ internal class FeaturesResources {
...
@@ -2277,9 +2277,9 @@ internal class FeaturesResources {
/// <summary>
/// <summary>
/// Looks up a localized string similar to Remove unused variable.
/// Looks up a localized string similar to Remove unused variable.
/// </summary>
/// </summary>
internal
static
string
Remove_
Unused_V
ariable
{
internal
static
string
Remove_
unused_v
ariable
{
get
{
get
{
return
ResourceManager
.
GetString
(
"Remove_
Unused_V
ariable"
,
resourceCulture
);
return
ResourceManager
.
GetString
(
"Remove_
unused_v
ariable"
,
resourceCulture
);
}
}
}
}
...
...
src/Features/Core/Portable/FeaturesResources.resx
浏览文件 @
9cf48870
...
@@ -1154,7 +1154,7 @@ This version used in: {2}</value>
...
@@ -1154,7 +1154,7 @@ This version used in: {2}</value>
<data
name=
"Add_argument_name_0"
xml:space=
"preserve"
>
<data
name=
"Add_argument_name_0"
xml:space=
"preserve"
>
<value>
Add argument name '{0}'
</value>
<value>
Add argument name '{0}'
</value>
</data>
</data>
<data
name=
"Remove_
Unused_V
ariable"
xml:space=
"preserve"
>
<data
name=
"Remove_
unused_v
ariable"
xml:space=
"preserve"
>
<value>
Remove unused variable
</value>
<value>
Remove unused variable
</value>
</data>
</data>
</root>
</root>
\ No newline at end of file
src/Features/VisualBasic/Portable/CodeFixes/RemoveUnusedVariable/RemoveUnusedVariableCodeFixProvider.vb
浏览文件 @
9cf48870
...
@@ -13,8 +13,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.RemoveUnusedVariable
...
@@ -13,8 +13,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.RemoveUnusedVariable
Inherits
AbstractRemoveUnusedVariableCodeFixProvider
(
Of
Inherits
AbstractRemoveUnusedVariableCodeFixProvider
(
Of
LocalDeclarationStatementSyntax
,
ModifiedIdentifierSyntax
,
VariableDeclaratorSyntax
)
LocalDeclarationStatementSyntax
,
ModifiedIdentifierSyntax
,
VariableDeclaratorSyntax
)
Friend
Const
BC42024
As
String
=
"BC42024"
Private
Const
BC42024
As
String
=
"BC42024"
Friend
Shared
ReadOnly
Ids
As
ImmutableArray
(
Of
String
)
=
ImmutableArray
.
Create
(
BC42024
)
Private
ReadOnly
Ids
As
ImmutableArray
(
Of
String
)
=
ImmutableArray
.
Create
(
BC42024
)
Public
Overrides
ReadOnly
Property
FixableDiagnosticIds
As
ImmutableArray
(
Of
String
)
Public
Overrides
ReadOnly
Property
FixableDiagnosticIds
As
ImmutableArray
(
Of
String
)
Get
Get
...
@@ -22,5 +22,4 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.RemoveUnusedVariable
...
@@ -22,5 +22,4 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.RemoveUnusedVariable
End
Get
End
Get
End
Property
End
Property
End
Class
End
Class
End
Namespace
End
Namespace
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录