Skip to content

Move await keyword to inside of function (Quick Fixed) #28818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 4, 2018
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
2 changes: 2 additions & 0 deletions src/harness/fourslash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4775,6 +4775,7 @@ namespace FourSlashInterface {
"package",
"yield",
"async",
"await",
].map(keywordEntry);

// TODO: many of these are inappropriate to always provide
Expand Down Expand Up @@ -4907,6 +4908,7 @@ namespace FourSlashInterface {
"package",
"yield",
"async",
"await",
].map(keywordEntry);

export const globalKeywordsPlusUndefined: ReadonlyArray<ExpectedCompletionEntryObject> = (() => {
Expand Down
2 changes: 1 addition & 1 deletion src/services/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ namespace ts.Completions {
}

function isFunctionLikeBodyKeyword(kind: SyntaxKind) {
return kind === SyntaxKind.AsyncKeyword || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
return kind === SyntaxKind.AsyncKeyword || kind === SyntaxKind.AwaitKeyword || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}

function keywordForNode(node: Node): SyntaxKind {
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/fourslash/completionInFunctionLikeBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
verify.completions(
{
marker: ["1", "2"],
includes: "async",
includes: ["async", "await"],
excludes: ["public", "private", "protected", "constructor", "readonly", "static", "abstract", "get", "set"],
},
{ marker: ["3", "4"], exact: completion.classElementKeywords, isNewIdentifierLocation: true },
Expand Down