Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
2f275691
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,发现更多精彩内容 >>
提交
2f275691
编写于
8月 17, 2017
作者:
C
CyrusNajmabadi
提交者:
GitHub
8月 17, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21597 from CyrusNajmabadi/ambiguousCompletion
Fix no completion in partially written code before 'await'.
上级
59f295a7
d5d90830
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
56 addition
and
6 deletion
+56
-6
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs
...tion/CompletionProviders/SymbolCompletionProviderTests.cs
+42
-0
src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs
...p/Portable/Recommendations/CSharpRecommendationService.cs
+14
-6
未找到文件。
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs
浏览文件 @
2f275691
...
@@ -2058,6 +2058,48 @@ class Program
...
@@ -2058,6 +2058,48 @@ class Program
await
VerifyItemExistsAsync
(
markup
,
"CompareTo"
);
await
VerifyItemExistsAsync
(
markup
,
"CompareTo"
);
}
}
[
WorkItem
(
21596
,
"https://github.com/dotnet/roslyn/issues/21596"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
AmbiguityBetweenExpressionAndLocalFunctionReturnType
()
{
var
markup
=
@"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
AwaitTest test = new AwaitTest();
test.Test1().Wait();
}
}
class AwaitTest
{
List<string> stringList = new List<string>();
public async Task<bool> Test1()
{
stringList.$$
await Test2();
return true;
}
public async Task<bool> Test2()
{
return true;
}
}"
;
await
VerifyItemExistsAsync
(
markup
,
"Add"
);
}
[
WorkItem
(
540750
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540750"
)]
[
WorkItem
(
540750
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540750"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
CompletionAfterNewInScript
()
public
async
Task
CompletionAfterNewInScript
()
...
...
src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs
浏览文件 @
2f275691
...
@@ -296,13 +296,21 @@ private static ImmutableArray<ISymbol> GetSymbolsForNamespaceDeclarationNameCont
...
@@ -296,13 +296,21 @@ private static ImmutableArray<ISymbol> GetSymbolsForNamespaceDeclarationNameCont
// int i = 5;
// int i = 5;
// i. // <-- here
// i. // <-- here
// List<string> ml = new List<string>();
// List<string> ml = new List<string>();
//
// The problem is that "i.List<string>" gets parsed as a type. In this case we need
// to try binding again as if "i" is an expression and not a type. In order to do
// that, we need to speculate as to what 'i' meant if it wasn't part of a local
// declaration's type.
//
// Another interesting case is something like:
//
// stringList.
// await Test2();
//
// Here "stringList.await" is thought of as the return type of a local function.
// The problem is that "i.List<string>" gets parsed as a type. In this case we need to
if
(
name
.
IsFoundUnder
<
LocalFunctionStatementSyntax
>(
d
=>
d
.
ReturnType
)
||
// try binding again as if "i" is an expression and not a type. In order to do that, we
name
.
IsFoundUnder
<
LocalDeclarationStatementSyntax
>(
d
=>
d
.
Declaration
.
Type
)
||
// need to speculate as to what 'i' meant if it wasn't part of a local declaration's
// type.
if
(
name
.
IsFoundUnder
<
LocalDeclarationStatementSyntax
>(
d
=>
d
.
Declaration
.
Type
)
||
name
.
IsFoundUnder
<
FieldDeclarationSyntax
>(
d
=>
d
.
Declaration
.
Type
))
name
.
IsFoundUnder
<
FieldDeclarationSyntax
>(
d
=>
d
.
Declaration
.
Type
))
{
{
var
speculativeBinding
=
context
.
SemanticModel
.
GetSpeculativeSymbolInfo
(
var
speculativeBinding
=
context
.
SemanticModel
.
GetSpeculativeSymbolInfo
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录