-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Populate inheritied properties and methods in completion list inside a class #7158
Comments
Should the same be done for ancestor interface members as well? Also, once the member has been implemented, should it stop being displayed in the completion list? |
I do not know about this one. currently you get no completion in an interface; I would start with class only.
That is correct |
What I mean is that you should get completion in a class deriving from an interface, just as you would in a class deriving from an abstract class. For example, if you had: interface B {
getValue() : number;
}
class C extends B {
| // <= expect getValue to show.
} You would still get the same completion options. |
i also should add, that in the absence of these completions, only applicable keywords should be shown, i.e. |
|
@mihailik I'm not changing the completion options that would normally be populated at that location, just adding some extras. Right now the list isn't limited to the applicable keywords you and @mhegazy have mentioned (this is actually marked as a TODO in the code). I think this is best left to a separate PR. |
Just because a base member is not abstract doesn't mean you can't override it. So only taking abstract members probably isn't the right approach. So let's say all base class members which are not currently overridden should be listed as suggestions in the body of a class. But it's not quite that simple. If a member exists, you might still be defining an overload, so you definitely don't want to remove that from a completion list. So as a first step, the completion list should consist of the above suggested keywords, alongside any base members. Don't worry about filtering candidates out for now. For examples of how to approach this, take a look at |
Gotcha, thanks. So the set of members to suggest (in addition to the keywords), is what would be suggested at |
@masaeedu yup, that sounds correct. |
Could it be possible if this autocompletes the signature and not just the identifier? abstract calss B {
abstract getValue(p1: number, p2: number) : number;
}
class C extends B {
| // <= expect 'getValue(p1: number, p2: number): number' to show.
} |
the API does not support a template-like completion at the moment. so either do identifiers only, or add a concept of replaceText to put the whole signature. |
I agree with @tinganho, a template-like completion for signatures would be greatly appreciated since in TypeScript it's very common to extend classes or implement interfaces. |
Is anybody working on this issue currently? |
@omniroot nope - you'll see someone in the "assigned" field before anyone begins work on it |
…mbers from base class Handles #7158
…mbers from base class Handles #7158
Not sure I'm following the process here - the issue marked as closed, however I still see this problem in current version of VSCode: How can I see from the issue, when it's planned to be in PROD? |
doesn't work for me as well, I'm using React Native and it doesn't seem to complete this.setState for instance or any method from React.Component. |
I guess someone needs to reopen or recreate the issue |
@sheetalkamat From what I can tell, method override autocompletion is not a desirable feature in VSCode and Typescript. Can you please confirm? |
We believe the issue has been fixed. if you are still running into issues please file a new ticket and provide enough information for us to reproduce it locally. |
The text was updated successfully, but these errors were encountered: