diff --git a/src/services/completions.ts b/src/services/completions.ts index 3d23e5ed41e..c8a0e50372f 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -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; diff --git a/tests/cases/fourslash/completionsObjectLiteralMethod6.ts b/tests/cases/fourslash/completionsObjectLiteralMethod6.ts new file mode 100644 index 00000000000..6898a256dd8 --- /dev/null +++ b/tests/cases/fourslash/completionsObjectLiteralMethod6.ts @@ -0,0 +1,19 @@ +/// + +// @Filename: a.ts +////type T = { +//// foo: () => Promise; +////} +////const foo: T = { +//// async f/**/ +////} + +verify.completions({ + marker: "", + includes: [ + { + name: "foo", + sortText: completion.SortText.LocationPriority, + }, + ], +});