mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
fix(40432): show as keyword in function context (#40481)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
11
tests/cases/fourslash/completionAsKeyword.ts
Normal file
11
tests/cases/fourslash/completionAsKeyword.ts
Normal 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 }]
|
||||
});
|
||||
Reference in New Issue
Block a user