Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2852,6 +2852,20 @@ await VerifyItemExistsAsync(markup, "classB", glyph: (int)Glyph.Local,
expectedDescriptionOrNull: CSharpFeaturesResources.Suggested_name);
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task TestNotForUnboundAsync()
{
var markup = @"
class C
{
async $$
}
";
await VerifyItemIsAbsentAsync(markup, "async");
await VerifyItemIsAbsentAsync(markup, "Async");
await VerifyItemIsAbsentAsync(markup, "GetAsync");
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(43816, "https://github.com/dotnet/roslyn/pull/43816")]
public async Task ConflictingLocalVariable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ public override async Task ProvideCompletionsAsync(CompletionContext completionC
return;
}

// Do not show name suggestions for unbound "async" identifier.
// Most likely user is writing an async method, so name suggestion will just interfere him
if (context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword) &&
semanticModel.GetSymbolInfo(context.TargetToken).GetAnySymbol() is null)
{
return;
}

var nameInfo = await NameDeclarationInfo.GetDeclarationInfoAsync(document, position, cancellationToken).ConfigureAwait(false);
using var _ = ArrayBuilder<(string name, SymbolKind kind)>.GetInstance(out var result);

Expand Down