From 95b16c2b8d8d6fbbe42d7cae6e8b164d984a5dbd Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 26 Jul 2021 13:04:49 -0700 Subject: [PATCH 1/2] Update included build tools to match .NET 6 Preview 7 SDK --- build/Packages.props | 2 +- tools/packages.config | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build/Packages.props b/build/Packages.props index f779ef748b..bf1ec4fd84 100644 --- a/build/Packages.props +++ b/build/Packages.props @@ -7,7 +7,7 @@ 16.9.4 16.10.0 5.2.0 - 4.0.0-2.21354.7 + 4.0.0-3.21373.8 2.4.1 diff --git a/tools/packages.config b/tools/packages.config index 9be70a1ae1..66dc2a1436 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -13,15 +13,15 @@ --> - - + + - - - - - + + + + + - - - - - + + + + + - + - + - - - - + + + + From f4a665441867e9d5faafd4db7a828caa71983263 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 26 Jul 2021 17:49:20 -0700 Subject: [PATCH 2/2] Account for new complex AwaitCompletionProvider --- .../Completion/CompletionListBuilder.cs | 1 + .../Completion/CompletionListBuilder_Async.cs | 31 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionListBuilder.cs b/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionListBuilder.cs index 52935f47b7..d7ba22f239 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionListBuilder.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionListBuilder.cs @@ -56,6 +56,7 @@ internal static partial class CompletionListBuilder { WellKnownTags.Warning, CompletionItemKind.Text }, }; + internal const string AwaitCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.AwaitCompletionProvider"; internal const string ObjectCreationCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.ObjectCreationCompletionProvider"; internal const string OverrideCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.OverrideCompletionProvider"; internal const string PartialMethodCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.PartialMethodCompletionProvider"; diff --git a/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionListBuilder_Async.cs b/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionListBuilder_Async.cs index 13d55b2f61..9e6814f7cd 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionListBuilder_Async.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionListBuilder_Async.cs @@ -32,8 +32,6 @@ internal static partial class CompletionListBuilder var seenUnimportedCompletions = false; var commitCharacterRuleCache = new Dictionary, IReadOnlyList>(); var commitCharacterRuleBuilder = new HashSet(); - var isOverrideOrPartialCompletion = completions.Items.Length > 0 - && completions.Items[0].GetProviderName() is OverrideCompletionProvider or PartialMethodCompletionProvider; for (int i = 0; i < completions.Items.Length; i++) { @@ -51,23 +49,26 @@ internal static partial class CompletionListBuilder // The completion is somehow expensive. Currently, this one of two categories: import completion, or override/partial // completion. Debug.Assert(completion.GetProviderName() is OverrideCompletionProvider or PartialMethodCompletionProvider - or TypeImportCompletionProvider or ExtensionMethodImportCompletionProvider); + or TypeImportCompletionProvider or ExtensionMethodImportCompletionProvider + or AwaitCompletionProvider); changeSpan = typedSpan; - if (isOverrideOrPartialCompletion) + switch (completion.GetProviderName()) { - // For override and partial completion, we don't want to use the DisplayText as the insert text because they contain - // characters that will affect our ability to asynchronously resolve the change later. - insertText = completion.FilterText; - sortText = GetSortText(completion, labelText, expectingImportedItems); - hasAfterInsertStep = true; - } - else - { - insertText = completion.DisplayText; - sortText = '1' + completion.SortText; - seenUnimportedCompletions = true; + case OverrideCompletionProvider or PartialMethodCompletionProvider or AwaitCompletionProvider: + // For override and partial completion, we don't want to use the DisplayText as the insert text because they contain + // characters that will affect our ability to asynchronously resolve the change later. + insertText = completion.FilterText; + sortText = GetSortText(completion, labelText, expectingImportedItems); + hasAfterInsertStep = true; + break; + + default: // case TypeImportCompletionProvider or ExtensionMethodImportCompletionProvider: + insertText = completion.DisplayText; + sortText = '1' + completion.SortText; + seenUnimportedCompletions = true; + break; } } else