mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
improve completions keyword for function like body (#25824)
This commit is contained in:
parent
98915693bc
commit
fedcd3a1b4
@ -2125,7 +2125,7 @@ namespace ts.Completions {
|
||||
case KeywordCompletionFilters.ConstructorParameterKeywords:
|
||||
return isParameterPropertyModifier(kind);
|
||||
case KeywordCompletionFilters.FunctionLikeBodyKeywords:
|
||||
return !isClassMemberCompletionKeyword(kind);
|
||||
return isFunctionLikeBodyKeyword(kind);
|
||||
case KeywordCompletionFilters.TypeKeywords:
|
||||
return isTypeKeyword(kind);
|
||||
default:
|
||||
@ -2151,6 +2151,10 @@ namespace ts.Completions {
|
||||
}
|
||||
}
|
||||
|
||||
function isFunctionLikeBodyKeyword(kind: SyntaxKind) {
|
||||
return kind === SyntaxKind.AsyncKeyword || !isClassMemberCompletionKeyword(kind);
|
||||
}
|
||||
|
||||
function keywordForNode(node: Node): SyntaxKind {
|
||||
return isIdentifier(node) ? node.originalKeywordKind || SyntaxKind.Unknown : node.kind;
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("async", "async", /*documentation*/ undefined, "keyword");
|
||||
verify.not.completionListContains("public", "public", /*documentation*/ undefined, "keyword");
|
||||
verify.not.completionListContains("private", "private", /*documentation*/ undefined, "keyword");
|
||||
verify.not.completionListContains("protected", "protected", /*documentation*/ undefined, "keyword");
|
||||
@ -26,6 +27,7 @@ verify.not.completionListContains("get", "get", /*documentation*/ undefined, "ke
|
||||
verify.not.completionListContains("set", "set", /*documentation*/ undefined, "keyword");
|
||||
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("async", "async", /*documentation*/ undefined, "keyword");
|
||||
verify.not.completionListContains("public", "public", /*documentation*/ undefined, "keyword");
|
||||
verify.not.completionListContains("private", "private", /*documentation*/ undefined, "keyword");
|
||||
verify.not.completionListContains("protected", "protected", /*documentation*/ undefined, "keyword");
|
||||
@ -41,3 +43,4 @@ verify.completionListContainsClassElementKeywords();
|
||||
|
||||
goTo.marker("4");
|
||||
verify.completionListContainsClassElementKeywords();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user