fix(53074): Functions with async keyword don't autocomplete (#53079)

This commit is contained in:
Oleksandr T
2023-03-03 10:31:01 -08:00
committed by GitHub
parent a34d5ae1ed
commit a9ae9eeb23
2 changed files with 21 additions and 0 deletions
+2
View File
@@ -4500,6 +4500,8 @@ function tryGetObjectLikeCompletionContainer(contextToken: Node | undefined): Ob
break;
case SyntaxKind.AsteriskToken:
return isMethodDeclaration(parent) ? tryCast(parent.parent, isObjectLiteralExpression) : undefined;
case SyntaxKind.AsyncKeyword:
return tryCast(parent.parent, isObjectLiteralExpression);
case SyntaxKind.Identifier:
return (contextToken as Identifier).text === "async" && isShorthandPropertyAssignment(contextToken.parent)
? contextToken.parent.parent : undefined;
@@ -0,0 +1,19 @@
/// <reference path="fourslash.ts" />
// @Filename: a.ts
////type T = {
//// foo: () => Promise<void>;
////}
////const foo: T = {
//// async f/**/
////}
verify.completions({
marker: "",
includes: [
{
name: "foo",
sortText: completion.SortText.LocationPriority,
},
],
});