Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
ee109508
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,发现更多精彩内容 >>
未验证
提交
ee109508
编写于
10月 31, 2019
作者:
I
Ivan Basov
提交者:
GitHub
10月 31, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Completion: provide all candidate symbols for overloads in lambda expressions (#39479)
上级
81fedeba
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
102 addition
and
2 deletion
+102
-2
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs
...tion/CompletionProviders/SymbolCompletionProviderTests.cs
+46
-0
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/SymbolCompletionProviderTests.vb
...tion/CompletionProviders/SymbolCompletionProviderTests.vb
+52
-0
src/Workspaces/Core/Portable/Recommendations/AbstractRecommendationServiceRunner.cs
...le/Recommendations/AbstractRecommendationServiceRunner.cs
+4
-2
未找到文件。
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs
浏览文件 @
ee109508
...
...
@@ -10130,6 +10130,52 @@ public async Task ThenIncludeNoGenericOverloads()
await
VerifyItemExistsAsync
(
markup
,
"FirstOrDefault"
,
displayTextSuffix
:
"<>"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
CompletionForLambdaWithOverloads
()
{
var
markup
=
@"
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace ClassLibrary1
{
class SomeItem
{
public string A;
public int B;
}
class SomeCollection<T> : List<T>
{
public virtual SomeCollection<T> Include(string path) => null;
}
static class Extensions
{
public static IList<T> Include<T, TProperty>(this IList<T> source, Expression<Func<T, TProperty>> path)
=> null;
public static IList Include(this IList source, string path) => null;
public static IList<T> Include<T>(this IList<T> source, string path) => null;
}
class Program
{
void M(SomeCollection<SomeItem> c)
{
var a = from m in c.Include(t => t.$$);
}
}
}"
;
await
VerifyItemExistsAsync
(
markup
,
"Substring"
);
await
VerifyItemExistsAsync
(
markup
,
"A"
);
await
VerifyItemExistsAsync
(
markup
,
"B"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
CompletionInsideMethodsWithNonFunctionsAsArguments
()
{
...
...
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/SymbolCompletionProviderTests.vb
浏览文件 @
ee109508
...
...
@@ -8065,6 +8065,58 @@ End Namespace"
Await VerifyItemExistsAsync(source, "
FirstOrDefault
")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function CompletionForLambdaWithOverloads() As Task
Dim source =
<code><![CDATA[
Imports System.Linq.Expressions
Imports System.Collections
Imports System
Imports System.Collections.Generic
Namespace VBTest
Public Class SomeItem
Public A As String
Public B As Integer
End Class
Class SomeCollection(Of T)
Inherits List(Of T)
Public Overridable Function Include(path As String) As SomeCollection(Of T)
Return Nothing
End Function
End Class
Module Extensions
<System.Runtime.CompilerServices.Extension>
Public Function Include(Of T, TProperty)(ByVal source As IList(Of T), path As Expression(Of Func(Of T, TProperty))) As IList(Of T)
Return Nothing
End Function
<System.Runtime.CompilerServices.Extension>
Public Function Include(ByVal source As IList, path As String) As IList
Return Nothing
End Function
<System.Runtime.CompilerServices.Extension>
Public Function Include(Of T)(ByVal source As IList(Of T), path As String) As IList(Of T)
Return Nothing
End Function
End Module
Class Program
Sub M(c As SomeCollection(Of SomeItem))
Dim a = From m In c.Include(Function(t) t.$$)
End Sub
End Class
End Namespace
]]></code>.Value
Await VerifyItemExistsAsync(source, "
Substring
")
Await VerifyItemExistsAsync(source, "
A
")
Await VerifyItemExistsAsync(source, "
B
")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function CompletionInsideMethodsWithNonFunctionsAsArguments() As Task
Dim source =
...
...
src/Workspaces/Core/Portable/Recommendations/AbstractRecommendationServiceRunner.cs
浏览文件 @
ee109508
...
...
@@ -66,9 +66,11 @@ protected ImmutableArray<ISymbol> GetSymbols(IParameterSymbol parameter, int pos
var
invocationExpression
=
lambdaSyntax
.
Parent
.
Parent
.
Parent
;
var
arguments
=
syntaxFactsService
.
GetArgumentsOfInvocationExpression
(
invocationExpression
);
var
ordinalInInvocation
=
arguments
.
IndexOf
(
lambdaSyntax
.
Parent
);
var
expressionOfInvocationExpression
=
syntaxFactsService
.
GetExpressionOfInvocationExpression
(
invocationExpression
);
var
invocation
=
_context
.
SemanticModel
.
GetSymbolInfo
(
invocationExpression
,
_cancellationToken
);
var
candidateSymbols
=
invocation
.
GetAllSymbols
();
// Get all members potentially matching the invocation expression.
// We filter them out based on ordinality later.
var
candidateSymbols
=
_context
.
SemanticModel
.
GetMemberGroup
(
expressionOfInvocationExpression
,
_cancellationToken
);
// parameter.Ordinal is the ordinal within (a,b,c) => b.
// For candidate symbols of (a,b,c) => b., get types of all possible b.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录