fix(40432): show as keyword in function context (#40481)

This commit is contained in:
Alex T
2020-09-17 12:15:48 +03:00
committed by GitHub
parent 02f5001839
commit d779a19053
3 changed files with 14 additions and 1 deletions

View File

@@ -1370,6 +1370,7 @@ namespace FourSlashInterface {
"let",
"package",
"yield",
"as",
"async",
"await",
].map(keywordEntry);
@@ -1510,6 +1511,7 @@ namespace FourSlashInterface {
"let",
"package",
"yield",
"as",
"async",
"await",
].map(keywordEntry);

View File

@@ -2585,7 +2585,6 @@ 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);
@@ -2660,6 +2659,7 @@ namespace ts.Completions {
function isFunctionLikeBodyKeyword(kind: SyntaxKind) {
return kind === SyntaxKind.AsyncKeyword
|| kind === SyntaxKind.AwaitKeyword
|| kind === SyntaxKind.AsKeyword
|| !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}

View File

@@ -0,0 +1,11 @@
/// <reference path="fourslash.ts" />
////const x = this /*1*/
////function foo() {
//// const x = this /*2*/
////}
verify.completions({
marker: ["1", "2"],
includes: [{ name: "as", sortText: completion.SortText.GlobalsOrKeywords }]
});