Add async to the list of class element completion keyword and refactoring according to feedback

This commit is contained in:
Sheetal Nandi
2017-05-11 11:42:36 -07:00
parent fcb0f46178
commit a8ad40f131
3 changed files with 10 additions and 5 deletions

View File

@@ -3426,7 +3426,8 @@ namespace FourSlashInterface {
"readonly",
"get",
"set",
"constructor"
"constructor",
"async"
];
constructor(protected state: FourSlash.TestState, private negative = false) {

View File

@@ -618,7 +618,8 @@ namespace ts.Completions {
if (classLikeContainer = tryGetClassLikeCompletionContainer(contextToken)) {
// cursor inside class declaration
return tryGetClassLikeCompletionSymbols(classLikeContainer);
getGetClassLikeCompletionSymbols(classLikeContainer);
return true;
}
if (jsxContainer = tryGetContainingJsxElement(contextToken)) {
@@ -929,7 +930,7 @@ namespace ts.Completions {
*
* @returns true if 'symbols' was successfully populated; false otherwise.
*/
function tryGetClassLikeCompletionSymbols(classLikeDeclaration: ClassLikeDeclaration): boolean {
function getGetClassLikeCompletionSymbols(classLikeDeclaration: ClassLikeDeclaration) {
// We're looking up possible property names from parent type.
isMemberCompletion = true;
// Declaring new property/method/accessor
@@ -965,8 +966,6 @@ namespace ts.Completions {
baseProperty => baseProperty.getDeclarations() && !(getDeclarationModifierFlagsFromSymbol(baseProperty) & ModifierFlags.Private));
}
}
return true;
}
/**
@@ -1431,6 +1430,7 @@ namespace ts.Completions {
case SyntaxKind.ReadonlyKeyword:
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
case SyntaxKind.AsyncKeyword:
return true;
}
}

View File

@@ -84,6 +84,9 @@
////class M extends B {
//// private static identi/*classThatStartedWritingIdentifierAfterPrivateStaticModifier*/
////}
////class N extends B {
//// async /*classThatHasWrittenAsyncKeyword*/
////}
const allowedKeywordCount = verify.allowedClassElementKeywords.length;
type CompletionInfo = [string, string];
@@ -171,6 +174,7 @@ const classInstanceElementLocations = [
"classThatStartedWritingIdentifierOfGetAccessor",
"classThatStartedWritingIdentifierOfSetAccessor",
"classThatStartedWritingIdentifierAfterModifier",
"classThatHasWrittenAsyncKeyword"
];
verifyClassElementLocations(instanceMemberInfo, classInstanceElementLocations);