Skip to content

[ty] Include keyword-prefixed symbols in completions for attributes#24232

Merged
charliermarsh merged 1 commit intomainfrom
charlie/set-keyword
Mar 27, 2026
Merged

[ty] Include keyword-prefixed symbols in completions for attributes#24232
charliermarsh merged 1 commit intomainfrom
charlie/set-keyword

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

We now accept keywords after the dot when completing attributes.

Closes astral-sh/ty#3142.

@astral-sh-bot astral-sh-bot bot added the ty Multi-file analysis & type inference label Mar 27, 2026
@charliermarsh charliermarsh added bug Something isn't working accepted Ready for implementation and removed ty Multi-file analysis & type inference labels Mar 27, 2026
@charliermarsh charliermarsh marked this pull request as ready for review March 27, 2026 02:03
@astral-sh-bot astral-sh-bot bot requested a review from dhruvmanila March 27, 2026 02:03
attribute: None,
}
} else if let Some([_dot, attribute]) =
token_suffix_by_kinds(before, OBJECT_DOT_NON_EMPTY)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This previously required exactly TokenKind::Name.

Copy link
Copy Markdown
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

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

Nice!

I think the title is a bit misleading because I first thought that the keywords are being included in the completion list when auto-completing an attribute but it's more like we're considering keywords before the cursor (in addition to Name token) when auto-completing an attribute.

The description is accurate, maybe use that as title? :)

@dhruvmanila dhruvmanila added server Related to the LSP server and removed accepted Ready for implementation labels Mar 27, 2026
@AlexWaygood AlexWaygood removed their request for review March 27, 2026 09:53
@charliermarsh charliermarsh changed the title [ty] Include keywords in completions for attributes [ty] Include keyword-prefixed symbols in completions for attributes Mar 27, 2026
@charliermarsh charliermarsh merged commit 6505b07 into main Mar 27, 2026
46 checks passed
@charliermarsh charliermarsh deleted the charlie/set-keyword branch March 27, 2026 14:30
carljm added a commit that referenced this pull request Mar 31, 2026
* main: (40 commits)
  [ty] resolve union-likes in emitting union attribute errors (#24263)
  [ty] Improve support for `Callable` type context (#23888)
  [ty] Propagate type context through `await` expressions (#24256)
  [`pyflakes`] Flag annotated variable redeclarations as `F811` in preview mode (#24244)
  [ty] Preserve `Divergent` when materializing recursive aliases (#24245)
  Fix W391 fixes for consecutive empty notebook cells (#24236)
  [flake8-bugbear] Clarify RUF071 fix safety for non-path string comparisons (#24149)
  [ty] Ban type qualifiers in PEP-695 type aliases (#24242)
  [ty] Include keyword-prefixed symbols in completions for attributes (#24232)
  [ty] Add tests for TypedDict method overloads on unions (#24230)
  [ty] report unused bindings as unnecessary hint diagnostics (#23305)
  Remove unused `non_root` variable (#24238)
  Extend F507 to flag %-format strings with zero placeholders (#24215)
  [`flake8-simplify`] Suppress `SIM105` for `except*` before Python 3.12 (#23869)
  Ignore pre-initialization references in SIM113 (#24235)
  Parenthesize expression in RUF050 fix (#24234)
  Publish playgrounds using the `release-playground` environment (#24223)
  [ty] Fix instance-attribute lookup in methods of protocol classes (#24213)
  [ty] Used shared expression cache during generic call inference (#24219)
  [ty] make `Type::BoundMethod` include instances of same-named methods bound to a subclass (#24039)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working server Related to the LSP server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect filtering of set completions

3 participants