impl Autocomplete Abstract, Protocol and method override #1589#2193
Open
asukaminato0721 wants to merge 5 commits into
Open
impl Autocomplete Abstract, Protocol and method override #1589#2193asukaminato0721 wants to merge 5 commits into
asukaminato0721 wants to merge 5 commits into
Conversation
asukaminato0721
commented
Jan 22, 2026
There was a problem hiding this comment.
Pull request overview
This PR implements a "Implement abstract members" quick fix feature that automatically generates method stubs for abstract methods and protocol members. The implementation detects unimplemented abstract methods from parent classes, copies their signatures/decorators/docstrings, and inserts properly formatted stub implementations.
Changes:
- Added new
implement_abstract_members.rsmodule with logic to detect and generate stubs for abstract/protocol methods - Integrated the quick fix into LSP code actions in
server.rs - Added comprehensive tests for abstract class members and Protocol implementations
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
pyrefly/lib/state/lsp/quick_fixes/implement_abstract_members.rs |
New module implementing the core logic for detecting abstract members and generating method stubs with proper signatures, decorators, and docstrings |
pyrefly/lib/state/lsp/quick_fixes/mod.rs |
Module declaration for the new implement_abstract_members module |
pyrefly/lib/state/lsp.rs |
Transaction method exposing the new quick fix functionality |
pyrefly/lib/lsp/non_wasm/server.rs |
LSP integration to include implement abstract members in code actions |
pyrefly/lib/alt/class/class_field.rs |
Changed visibility of get_class_member_with_defining_class to pub(crate) to support the new feature |
pyrefly/lib/test/lsp/code_actions.rs |
Added test helper functions and two comprehensive tests for abstract and protocol implementations; also modified an existing test but introduced a bug with missing ABC import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Up we need this <3 |
d74bcc9 to
9131e7d
Compare
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
cc @jvansch1 |
This comment has been minimized.
This comment has been minimized.
07a612e to
5c39913
Compare
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
cc @jvansch1 |
59ffc03 to
2553235
Compare
This comment has been minimized.
This comment has been minimized.
2553235 to
6d11d6f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes part of #1589 #2207
microsoft/pylance-release#146
Implemented an “Implement abstract members” quick fix that derives missing abstract members via the solver, copies signatures/decorators/docstrings, and inserts stubs into the selected class, then wired it into LSP code actions.
Test Plan
added a test.