* Aggregates relevant symbols for completion in class declaration * Relevant symbols are stored in the captured 'symbols' variable.
()
| 134459 | * Relevant symbols are stored in the captured 'symbols' variable. |
| 134460 | */ |
| 134461 | function tryGetClassLikeCompletionSymbols() { |
| 134462 | var decl = tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position); |
| 134463 | if (!decl) |
| 134464 | return 0 /* GlobalsSearch.Continue */; |
| 134465 | // We're looking up possible property names from parent type. |
| 134466 | completionKind = 3 /* CompletionKind.MemberLike */; |
| 134467 | // Declaring new property/method/accessor |
| 134468 | isNewIdentifierLocation = true; |
| 134469 | keywordFilters = contextToken.kind === 41 /* SyntaxKind.AsteriskToken */ ? 0 /* KeywordCompletionFilters.None */ : |
| 134470 | ts.isClassLike(decl) ? 2 /* KeywordCompletionFilters.ClassElementKeywords */ : 3 /* KeywordCompletionFilters.InterfaceElementKeywords */; |
| 134471 | // If you're in an interface you don't want to repeat things from super-interface. So just stop here. |
| 134472 | if (!ts.isClassLike(decl)) |
| 134473 | return 1 /* GlobalsSearch.Success */; |
| 134474 | var classElement = contextToken.kind === 26 /* SyntaxKind.SemicolonToken */ ? contextToken.parent.parent : contextToken.parent; |
| 134475 | var classElementModifierFlags = ts.isClassElement(classElement) ? ts.getEffectiveModifierFlags(classElement) : 0 /* ModifierFlags.None */; |
| 134476 | // If this is context token is not something we are editing now, consider if this would lead to be modifier |
| 134477 | if (contextToken.kind === 79 /* SyntaxKind.Identifier */ && !isCurrentlyEditingNode(contextToken)) { |
| 134478 | switch (contextToken.getText()) { |
| 134479 | case "private": |
| 134480 | classElementModifierFlags = classElementModifierFlags | 8 /* ModifierFlags.Private */; |
| 134481 | break; |
| 134482 | case "static": |
| 134483 | classElementModifierFlags = classElementModifierFlags | 32 /* ModifierFlags.Static */; |
| 134484 | break; |
| 134485 | case "override": |
| 134486 | classElementModifierFlags = classElementModifierFlags | 16384 /* ModifierFlags.Override */; |
| 134487 | break; |
| 134488 | } |
| 134489 | } |
| 134490 | if (ts.isClassStaticBlockDeclaration(classElement)) { |
| 134491 | classElementModifierFlags |= 32 /* ModifierFlags.Static */; |
| 134492 | } |
| 134493 | // No member list for private methods |
| 134494 | if (!(classElementModifierFlags & 8 /* ModifierFlags.Private */)) { |
| 134495 | // List of property symbols of base type that are not private and already implemented |
| 134496 | var baseTypeNodes = ts.isClassLike(decl) && classElementModifierFlags & 16384 /* ModifierFlags.Override */ ? ts.singleElementArray(ts.getEffectiveBaseTypeNode(decl)) : ts.getAllSuperTypeNodes(decl); |
| 134497 | var baseSymbols = ts.flatMap(baseTypeNodes, function (baseTypeNode) { |
| 134498 | var type = typeChecker.getTypeAtLocation(baseTypeNode); |
| 134499 | return classElementModifierFlags & 32 /* ModifierFlags.Static */ ? |
| 134500 | (type === null || type === void 0 ? void 0 : type.symbol) && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) : |
| 134501 | type && typeChecker.getPropertiesOfType(type); |
| 134502 | }); |
| 134503 | symbols = ts.concatenate(symbols, filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags)); |
| 134504 | } |
| 134505 | return 1 /* GlobalsSearch.Success */; |
| 134506 | } |
| 134507 | function isConstructorParameterCompletion(node) { |
| 134508 | return !!node.parent && ts.isParameter(node.parent) && ts.isConstructorDeclaration(node.parent.parent) |
| 134509 | && (ts.isParameterPropertyModifier(node.kind) || ts.isDeclarationName(node)); |
no test coverage detected