[CodeCompletion] Don't recommend functions with async alternatives in async contexts

When an function has an async alternative, that should be preferred when we are completing in an async context. Thus, the sync method should be marked as not recommended if the current context can handle async methods.

rdar://88354910
This commit is contained in:
Alex Hoppen
2022-08-01 14:24:53 +02:00
parent 5c29bd2968
commit daec367b46
10 changed files with 69 additions and 30 deletions

View File

@@ -1168,7 +1168,8 @@ Completion *CompletionBuilder::finish() {
contextFreeBase.getKind(),
contextFreeBase.getOpaqueAssociatedKind(), opKind,
contextFreeBase.isSystem(), contextFreeBase.isAsync(),
newCompletionString, contextFreeBase.getModuleName(),
contextFreeBase.hasAsyncAlternative(), newCompletionString,
contextFreeBase.getModuleName(),
contextFreeBase.getBriefDocComment(),
contextFreeBase.getAssociatedUSRs(),
contextFreeBase.getResultType(),