-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
Generate stubs for implementing abstract methods from superclass #1790
Comments
How are you using Jedi? With a language server or what? |
With jedi-language-server. But I figured Jedi needs to offer such a feature before any language server can offer it as a code action. |
In a similar way, the Rust language server has a similar feature, but integrates it at completion time (you start writing a function name and it completes the entire signature, almost ready to be implemented). |
Jedi already does that in a way, because it completes @idanarye The problem I see then is that the language servers currently don't have a "normal" way of doing this like |
Language servers do this via code actions. At least - that's what rust-analyzer does. If Jedi offers the backend, the language server can use it to format a code action which any LSP client knows how to use. Or maybe Jedi can also offer a code actions mechanism, and then every code action added to Jedi will automatically be available to all language servers that have interfaced to that mechanism? |
But how would such a code action look like? What's the CodeActionKind? I know that that's what code actions are targeted at, but I'm not sure how editors work with such language specific actions that are not a CodeActionKind like rename/inline/etc. |
rust-analyzer sets the kind to "quickfix", but it hardly matters - The idea behind code actions is that you point the language server at a file, or at a code range within a file, and the server spits out suggestions of things that can be done there - inline code, add annotations, extract expression, fill missing parameters, implement missing methods, whatever. They are usually tied to the diagnostics the language server provided, so if the language server noticed a problem it can also offer a solution, but there can also be standalone code actions. The IDE/editor, then, presents these suggested code actions to the user, and the user can pick a code action and tell the IDE to perform it. The code action can carry a list of text edits that the client can perform itself, or it can carry a command that the client can send back to the server to perform the action (it can have both, but I'm not sure what it's useful for) |
I'm not against this, but I feel like we should do autocompletion first. I'm keeping it open for that. The other thing is something you or somebody else could implement, but it would need to be very solid for it to be accepted. This means testing of all the different cases (staticmethod, property, etc). |
PyCharm can generate stubs for implementing abstract methods in a subclass. If you have something like this:
PyCharm can transform it to this:
Could something similar be added to Jedi?
The text was updated successfully, but these errors were encountered: