[pyrefly] Expose inferred type hints as quick fixes#4243
Conversation
Reuse insertable inlay hint edits in the quick-fix menu so users can materialize inferred annotations without targeting the rendered hint. Keep the initial behavior scoped to existing type hints and preserve their configuration and safety filters.
|
Hi @shubhamshettyy! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Potential Follow-upTo keep this initial change small and appropriate for a good-first issue, it identifies type hints from their existing |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Reuse insertable inlay hint edits in the quick-fix menu so users can materialize inferred annotations through code actions instead of double-clicking the rendered hint. Keep the initial behavior scoped to existing type hints while preserving their configuration and safety filters.
Summary
Transaction::inlay_hintsfrom the existing quick-fix handler.value=, since they are not type annotations.The implementation obtains the configured inlay hints during
textDocument/codeAction, filters for safely insertable type hints whose insertion position is covered by the requested range, and converts the matching hint into aCodeActionKind::QUICKFIXcontaining a zero-widthTextEdit.Fixes #4231
Test Plan
Added LSP integration coverage for:
Ran:
cargo test insert_inferred_type_annotationRan the required formatting and lint checks:
python3 test.py --no-test --no-tensor-shapes --no-conformance --no-jsonschema