Skip to content

impl Autocomplete Abstract, Protocol and method override #1589#2193

Open
asukaminato0721 wants to merge 5 commits into
facebook:mainfrom
asukaminato0721:1589-1
Open

impl Autocomplete Abstract, Protocol and method override #1589#2193
asukaminato0721 wants to merge 5 commits into
facebook:mainfrom
asukaminato0721:1589-1

Conversation

@asukaminato0721

@asukaminato0721 asukaminato0721 commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

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.

@meta-cla meta-cla Bot added the cla signed label Jan 22, 2026
@asukaminato0721 asukaminato0721 changed the title impl Autocomplete Abstract, Protocol and method override #146 Jan 22, 2026
@asukaminato0721 asukaminato0721 marked this pull request as ready for review January 22, 2026 12:01
Copilot AI review requested due to automatic review settings January 22, 2026 12:01
Comment thread pyrefly/lib/test/lsp/code_actions.rs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.rs module 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.

Comment thread pyrefly/lib/test/lsp/code_actions.rs
Comment thread pyrefly/lib/test/lsp/code_actions.rs
@github-actions

This comment has been minimized.

@asukaminato0721 asukaminato0721 marked this pull request as draft January 22, 2026 12:35
@asukaminato0721 asukaminato0721 marked this pull request as ready for review January 22, 2026 15:11
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@mohaidoss

Copy link
Copy Markdown

Up we need this <3

@github-actions

This comment has been minimized.

@asukaminato0721

Copy link
Copy Markdown
Contributor Author
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@asukaminato0721

Copy link
Copy Markdown
Contributor Author
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment