From ef5573b266e43b0ffafe10610da54fc3d2e223cc Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 23 Jan 2020 08:29:06 -0800 Subject: [PATCH] Add `as` completions (#36359) --- src/harness/fourslashInterfaceImpl.ts | 2 ++ src/services/completions.ts | 1 + tests/cases/fourslash/completionTypeAssertion.ts | 5 +++++ 3 files changed, 8 insertions(+) create mode 100644 tests/cases/fourslash/completionTypeAssertion.ts diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 1e32b892b9c..14356ecc479 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1152,6 +1152,7 @@ namespace FourSlashInterface { "let", "package", "yield", + "as", "asserts", "any", "async", @@ -1352,6 +1353,7 @@ namespace FourSlashInterface { "let", "package", "yield", + "as", "asserts", "any", "async", diff --git a/src/services/completions.ts b/src/services/completions.ts index 255a0217207..181128fbaf4 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -2461,6 +2461,7 @@ namespace ts.Completions { || kind === SyntaxKind.ModuleKeyword || kind === SyntaxKind.TypeKeyword || kind === SyntaxKind.NamespaceKeyword + || kind === SyntaxKind.AsKeyword || isTypeKeyword(kind) && kind !== SyntaxKind.UndefinedKeyword; case KeywordCompletionFilters.FunctionLikeBodyKeywords: return isFunctionLikeBodyKeyword(kind); diff --git a/tests/cases/fourslash/completionTypeAssertion.ts b/tests/cases/fourslash/completionTypeAssertion.ts new file mode 100644 index 00000000000..bb5c6f8abda --- /dev/null +++ b/tests/cases/fourslash/completionTypeAssertion.ts @@ -0,0 +1,5 @@ +/// + +//// var x = this as/*1*/ + +verify.completions({marker: "1", exact: completion.globalsPlus(["x"]) })