Skip to content

Add hover support for in keyword (#1926)#1927

Closed
jackulau wants to merge 3 commits into
facebook:mainfrom
jackulau:1926
Closed

Add hover support for in keyword (#1926)#1927
jackulau wants to merge 3 commits into
facebook:mainfrom
jackulau:1926

Conversation

@jackulau
Copy link
Copy Markdown
Contributor

Summary

  • Adds contextual hover for the in keyword in membership tests (shows __contains__ method signature)
  • Adds contextual hover for the in keyword in iteration contexts (shows iterable type)

Fixes #1926

Test plan

  • Added tests for in in membership test with custom __contains__
  • Added tests for in in for-loops
  • Added tests for in in list comprehensions
  • Added test for exact example from issue: [x for x in x if x in [1]]

Show contextual hover for `in` in both membership tests (displays
__contains__ signature) and iteration contexts (shows iterable type).
@meta-cla meta-cla Bot added the cla signed label Dec 24, 2025
@github-actions

This comment has been minimized.

Comment thread pyrefly/lib/lsp/wasm/hover.rs Outdated
@github-actions
Copy link
Copy Markdown

Diff from mypy_primer, showing the effect of this PR on open source code:

typeshed-stats (https://github.com/AlexWaygood/typeshed-stats)
- ERROR src/typeshed_stats/gather.py:999:28-1002:10: `Pattern[Unknown] | @5300 | None` is not assignable to upper bound `bytes | str` of type variable `AnyStr` [bad-specialization]
+ ERROR src/typeshed_stats/gather.py:999:28-1002:10: `Pattern[Unknown] | @7438 | None` is not assignable to upper bound `bytes | str` of type variable `AnyStr` [bad-specialization]

@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented Dec 26, 2025

@grievejia has imported this pull request. If you are a Meta employee, you can view this in D89812790.

@grievejia grievejia self-assigned this Dec 26, 2025
Copy link
Copy Markdown
Contributor

@yangdanny97 yangdanny97 left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

Copy link
Copy Markdown
Contributor

@yangdanny97 yangdanny97 left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity for more than 2 weeks.

If you are still working on this this pull request, please add a comment or push new commits to keep it active. Otherwise, please unassign yourself and allow someone else to take over.

Thank you for your contributions!

@github-actions github-actions Bot added the stale label Jan 13, 2026
Copy link
Copy Markdown
Contributor

@yangdanny97 yangdanny97 left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented Jan 16, 2026

@grievejia merged this pull request in 815b977.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

show hover for in

5 participants