When writing class elements show completion with allowed keywords and inheritted properties#15614
Conversation
…mbers from base class Handles #7158
…vate, readonly Also when name of the function is location, make sure we are actually looking at the same symbol before using the declaration to get signature to display
Do not show inherited members in completion for when writing private member Show only static inherited members when writing static member
| "readonly", | ||
| "get", | ||
| "set", | ||
| "constructor" |
| case SyntaxKind.ConstructorKeyword: | ||
| case SyntaxKind.ReadonlyKeyword: | ||
| case SyntaxKind.GetKeyword: | ||
| case SyntaxKind.SetKeyword: |
| function tryGetClassLikeCompletionContainer(contextToken: Node): ClassLikeDeclaration { | ||
| if (contextToken) { | ||
| switch (contextToken.kind) { | ||
| case SyntaxKind.OpenBraceToken: // class c { | |
There was a problem hiding this comment.
index signature, and computed property name:
class c {
| ["foo"] // <- i would expect the keywords at least
}| * Relevant symbols are stored in the captured 'symbols' variable. | ||
| * | ||
| * @returns true if 'symbols' was successfully populated; false otherwise. | ||
| */ |
There was a problem hiding this comment.
this function only returns true, it should be getClassLikeCompletionSymbols
There was a problem hiding this comment.
Was just following the pattern, but I will change it
| typeChecker.getTypeOfSymbolAtLocation(baseType.symbol, classLikeDeclaration) : | ||
| baseType; | ||
|
|
||
| // List of property symbols of base type that are not private |
There was a problem hiding this comment.
we should filter ones that are already implemented in the current class.
There was a problem hiding this comment.
@DanielRosenwasser commented on the issue saying not to do that. Reference
There was a problem hiding this comment.
we do filtering in object literal completions, ppl seem to appreciate that.
| } | ||
|
|
||
| // No member list for private methods | ||
| if (!(classElementModifierFlags & ModifierFlags.Private)) { |
There was a problem hiding this comment.
Do we want to show the Implements clause members too? The issue didn't clearly mention it.
There was a problem hiding this comment.
well.. probably, do not see why not. like it is likely that it is a member you are implementing or extending..
Handles #7158