Skip to content

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Jun 2, 2025

Summary

This PR plugs in @BurntSushi's completion provider to the playground.

CC: @BurntSushi mainly so that you see in which places you may need to make changes when adding more information to completions.

Test Plan

This was a bit tricky to test but I noticed that play.ty.dev suggests parameter (no idea why) and we can see now that ty's completions don't suggest parameter.

Screen.Recording.2025-06-02.at.09.49.45.mov

@MichaReiser MichaReiser added playground A playground-specific issue ty Multi-file analysis & type inference labels Jun 2, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2025

mypy_primer results

No ecosystem changes detected ✅

@sharkdp
Copy link
Contributor

sharkdp commented Jun 2, 2025

suggests parameter (no idea why)

I guess it's just the word "parameter" in the "Add parameter annotations …" line comment.

@MichaReiser MichaReiser merged commit 67d94d9 into main Jun 3, 2025
35 checks passed
@MichaReiser MichaReiser deleted the micha/playground-completions branch June 3, 2025 08:11
dcreager added a commit that referenced this pull request Jun 3, 2025
…aration

* origin/main:
  [ty] Infer `list[T]` when unpacking non-tuple type (#18438)
  [ty] Meta-type of type variables should be type[..] (#18439)
  [`pyupgrade`] Make fix unsafe if it deletes comments (`UP050`) (#18390)
  [`pyupgrade`] Make fix unsafe if it deletes comments (`UP004`) (#18393)
  [ty] Support using legacy typing aliases for generic classes in type annotations (#18404)
  Use ty's completions in playground (#18425)
  Update editor setup docs about Neovim and Vim (#18324)
  Update NPM Development dependencies (#18423)
  Infer `list[T]` for starred target in unpacking (#18401)
  [`refurb`] Mark `FURB180` fix unsafe when class has bases (#18149)
  [`fastapi`] Avoid false positive for class dependencies (`FAST003`) (#18271)
@AlexWaygood
Copy link
Member

This was a bit tricky to test but I noticed that play.ty.dev suggests parameter (no idea why) and we can see now that ty's completions don't suggest parameter.

* imports are a great way to test this, FWIW. This is awesome! 😃

image

(Though it does look like there's a few symbols there such as ReadableBuffer that weren't actually imported by the * import -- they have Definitions in the semantic index, but the visibilities of those Definitions should be resolved to AlwaysFalse during type-checking)

carljm added a commit to mtshiba/ruff that referenced this pull request Jun 4, 2025
* main:
  [ty] Add tests for empty list/tuple unpacking (astral-sh#18451)
  [ty] Argument type expansion for overload call evaluation (astral-sh#18382)
  [ty] Minor cleanup for `site-packages` discovery logic (astral-sh#18446)
  [ty] Add generic inference for dataclasses (astral-sh#18443)
  [ty] dataclasses: Allow using dataclasses.dataclass as a function. (astral-sh#18440)
  [ty] Create separate `FunctionLiteral` and `FunctionType` types (astral-sh#18360)
  [ty] Infer `list[T]` when unpacking non-tuple type (astral-sh#18438)
  [ty] Meta-type of type variables should be type[..] (astral-sh#18439)
  [`pyupgrade`] Make fix unsafe if it deletes comments (`UP050`) (astral-sh#18390)
  [`pyupgrade`] Make fix unsafe if it deletes comments (`UP004`) (astral-sh#18393)
  [ty] Support using legacy typing aliases for generic classes in type annotations (astral-sh#18404)
  Use ty's completions in playground (astral-sh#18425)
  Update editor setup docs about Neovim and Vim (astral-sh#18324)
  Update NPM Development dependencies (astral-sh#18423)
@sharkdp
Copy link
Contributor

sharkdp commented Jun 4, 2025

(Though it does look like there's a few symbols there such as ReadableBuffer that weren't actually imported by the * import -- they have Definitions in the semantic index, but the visibilities of those Definitions should be resolved to AlwaysFalse during type-checking)

This will be resolved by #18456

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

Labels

playground A playground-specific issue ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants