Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
1478c7ba
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,发现更多精彩内容 >>
提交
1478c7ba
编写于
12月 02, 2015
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't trigger Add-Using on an identifier being missing
上级
f010e8f9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
38 deletion
+47
-38
src/EditorFeatures/CSharpTest/Diagnostics/AddUsing/AddUsingTests.cs
...Features/CSharpTest/Diagnostics/AddUsing/AddUsingTests.cs
+30
-30
src/Features/CSharp/Portable/CodeFixes/AddImport/CSharpAddImportCodeFixProvider.cs
...ble/CodeFixes/AddImport/CSharpAddImportCodeFixProvider.cs
+0
-7
src/Features/Core/Portable/Diagnostics/Analyzers/UnboundIdentifiersDiagnosticAnalyzerBase.cs
...ics/Analyzers/UnboundIdentifiersDiagnosticAnalyzerBase.cs
+17
-1
未找到文件。
src/EditorFeatures/CSharpTest/Diagnostics/AddUsing/AddUsingTests.cs
浏览文件 @
1478c7ba
...
...
@@ -881,35 +881,6 @@ public async Task TestConflictedGenericName()
@"using System.Threading.Tasks; using Task = System.AccessViolationException; class X { Task<X> x; }"
);
}
[
WorkItem
(
860648
)]
[
WorkItem
(
902014
)]
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddUsing
)]
public
async
Task
TestIncompleteSimpleLambdaExpression
()
{
await
TestAsync
(
@"using System.Linq;
class Program
{
static void Main(string[] args)
{
[|args[0].Any(x => IBindCtx|]
string a;
}
}"
,
@"using System.Linq;
using System.Runtime.InteropServices.ComTypes;
class Program
{
static void Main(string[] args)
{
args[0].Any(x => IBindCtx
string a;
}
}"
);
}
[
WorkItem
(
913300
)]
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddUsing
)]
public
async
Task
TestNoDuplicateReport
()
...
...
@@ -2168,8 +2139,37 @@ void Foo()
Action a = () => { IBindCtx };
string a;
}
}"
);
}
[
WorkItem
(
860648
)]
[
WorkItem
(
902014
)]
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddUsing
)]
public
async
Task
TestIncompleteSimpleLambdaExpression
()
{
await
TestAsync
(
@"using System.Linq;
class Program
{
static void Main(string[] args)
{
args[0].Any(x => [|IBindCtx|]
string a;
}
}"
,
@"using System.Linq;
using System.Runtime.InteropServices.ComTypes;
class Program
{
static void Main(string[] args)
{
args[0].Any(x => IBindCtx
string a;
}
}"
);
}
}
}
}
}
\ No newline at end of file
src/Features/CSharp/Portable/CodeFixes/AddImport/CSharpAddImportCodeFixProvider.cs
浏览文件 @
1478c7ba
...
...
@@ -72,11 +72,6 @@ internal class CSharpAddImportCodeFixProvider : AbstractAddImportCodeFixProvider
/// </summary>
private
const
string
CS0616
=
"CS0616"
;
/// <summary>
/// Syntax error, 'A' expected
/// </summary>
private
const
string
CS1003
=
"CS1003"
;
/// <summary>
/// No overload for method 'X' takes 'N' arguments
/// </summary>
...
...
@@ -126,7 +121,6 @@ public override ImmutableArray<string> FixableDiagnosticIds
CS0122
,
CS0307
,
CS0616
,
CS1003
,
CS1501
,
CS1503
,
CS1574
,
...
...
@@ -264,7 +258,6 @@ protected override bool CanAddImportForType(Diagnostic diagnostic, ref SyntaxNod
case
CS0122
:
case
CS0307
:
case
CS0616
:
case
CS1003
:
case
CS1580
:
case
CS1581
:
break
;
...
...
src/Features/Core/Portable/Diagnostics/Analyzers/UnboundIdentifiersDiagnosticAnalyzerBase.cs
浏览文件 @
1478c7ba
...
...
@@ -45,12 +45,28 @@ protected DiagnosticDescriptor GetDiagnosticDescriptor(string id, LocalizableStr
private
void
AnalyzeNode
(
SyntaxNodeAnalysisContext
context
)
{
if
(
(
context
.
Node
is
TLambdaExpressionSyntax
&&
context
.
Node
.
ContainsDiagnostics
)
||
context
.
Node
is
TIncompleteMemberSyntax
)
if
(
IsBrokenLambda
(
context
)
||
context
.
Node
is
TIncompleteMemberSyntax
)
{
ReportUnboundIdentifierNames
(
context
,
context
.
Node
);
}
}
private
static
bool
IsBrokenLambda
(
SyntaxNodeAnalysisContext
context
)
{
if
(
context
.
Node
is
TLambdaExpressionSyntax
)
{
if
(
context
.
Node
.
ContainsDiagnostics
)
{
return
true
;
}
var
lastToken
=
context
.
Node
.
GetLastToken
();
return
lastToken
.
GetNextToken
(
includeZeroWidth
:
true
).
IsMissing
;
}
return
false
;
}
private
void
ReportUnboundIdentifierNames
(
SyntaxNodeAnalysisContext
context
,
SyntaxNode
member
)
{
Func
<
SyntaxNode
,
bool
>
isQualifiedOrSimpleName
=
(
SyntaxNode
n
)
=>
n
is
TQualifiedNameSyntax
||
n
is
TSimpleNameSyntax
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录