From 6dc4f50591501b73d10c361e7ea42568023c1f7b Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 22 Jan 2020 13:03:42 -0800 Subject: [PATCH] Add `as` completions --- 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 1e32b892b9c60..14356ecc4799b 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 255a0217207ea..181128fbaf496 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 0000000000000..bb5c6f8abda29 --- /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"]) })