提交 da6d0c35 编写于 作者: I Ivan Basov

code review feedback

上级 6927b390
......@@ -204,6 +204,22 @@ class c { void M() { this.$$ToString() } }
End Using
End Function
<MemberData(NameOf(AllCompletionImplementations))>
<WpfTheory, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestInvokingCompletionBetweenTwoDots(completionImplementation As CompletionImplementation) As Task
' Starting C# 8.0 two dots are considered as a DotDotToken of a Range expression.
' However, we may want to have a completion when invoking it aqfter the first dot.
Using state = TestStateFactory.CreateCSharpTestState(completionImplementation,
<Document>
class c { void M() { this.$$.ToString() } }
</Document>)
state.SendInvokeCompletionList()
Await state.AssertCompletionSession()
Assert.True(state.CompletionItemsContainsAll({"ToString"}))
End Using
End Function
<MemberData(NameOf(AllCompletionImplementations))>
<WpfTheory, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestEnterIsConsumed(completionImplementation As CompletionImplementation) As Task
......
......@@ -48,7 +48,7 @@ internal sealed class CSharpSyntaxContext : SyntaxContext
public readonly bool IsCrefContext;
public readonly bool IsCatchFilterContext;
public readonly bool IsDestructorTypeContext;
public readonly bool IsFirstDotOfDotDotToken;
public readonly bool IsAfterFirstDotOfDotDot;
private CSharpSyntaxContext(
Workspace workspace,
......@@ -100,7 +100,7 @@ internal sealed class CSharpSyntaxContext : SyntaxContext
bool isDestructorTypeContext,
bool isPossibleTupleContext,
bool isPatternContext,
bool isFirstDotOfDotDotToken,
bool isAfterFirstDotOfDotDot,
CancellationToken cancellationToken)
: base(workspace, semanticModel, position, leftToken, targetToken,
isTypeContext, isNamespaceContext, isNamespaceDeclarationNameContext,
......@@ -140,7 +140,7 @@ internal sealed class CSharpSyntaxContext : SyntaxContext
this.IsCrefContext = isCrefContext;
this.IsCatchFilterContext = isCatchFilterContext;
this.IsDestructorTypeContext = isDestructorTypeContext;
this.IsFirstDotOfDotDotToken = isFirstDotOfDotDotToken;
this.IsAfterFirstDotOfDotDot = isAfterFirstDotOfDotDot;
}
public static CSharpSyntaxContext CreateContext(Workspace workspace, SemanticModel semanticModel, int position, CancellationToken cancellationToken)
......@@ -198,8 +198,7 @@ private static CSharpSyntaxContext CreateContextWorker(Workspace workspace, Sema
targetToken.Parent.IsKind(SyntaxKind.DestructorDeclaration) &&
targetToken.Parent.Parent.IsKind(SyntaxKind.ClassDeclaration, SyntaxKind.StructDeclaration);
var isFirstDotOfDotDotToken = targetToken.IsKind(SyntaxKind.DotDotToken) &&
targetToken.Parent.IsKind(SyntaxKind.RangeExpression) &&
var isAfterFirstDotOfDotDot = targetToken.IsKind(SyntaxKind.DotDotToken) &&
position == targetToken.SpanStart + 1;
return new CSharpSyntaxContext(
......@@ -252,7 +251,7 @@ private static CSharpSyntaxContext CreateContextWorker(Workspace workspace, Sema
isDestructorTypeContext: isDestructorTypeContext,
isPossibleTupleContext: syntaxTree.IsPossibleTupleContext(leftToken, position),
isPatternContext: syntaxTree.IsPatternContext(leftToken, position),
isFirstDotOfDotDotToken: isFirstDotOfDotDotToken,
isAfterFirstDotOfDotDot: isAfterFirstDotOfDotDot,
cancellationToken: cancellationToken);
}
......
......@@ -66,6 +66,7 @@ internal class CSharpRecommendationService : AbstractRecommendationService
}
else if (context.IsAnyExpressionContext ||
context.IsStatementContext ||
context.IsAfterFirstDotOfDotDot ||
context.SyntaxTree.IsDefiniteCastTypeContext(context.Position, context.LeftToken, cancellationToken))
{
// GitHub #717: With automatic brace completion active, typing '(i' produces "(i)", which gets parsed as
......@@ -94,10 +95,6 @@ internal class CSharpRecommendationService : AbstractRecommendationService
{
return GetSymbolsForNamespaceDeclarationNameContext(context, cancellationToken);
}
else if (context.IsFirstDotOfDotDotToken)
{
return GetSymbolsForExpressionOrStatementContext(context, filterOutOfScopeLocals, cancellationToken);
}
return ImmutableArray<ISymbol>.Empty;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册