Skip to content

Comments

[ty] Enable even more goto-definition on inlay hints#21950

Merged
Gankra merged 1 commit intomainfrom
alex/more-inlay-goto
Dec 12, 2025
Merged

[ty] Enable even more goto-definition on inlay hints#21950
Gankra merged 1 commit intomainfrom
alex/more-inlay-goto

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Dec 12, 2025

Summary

Working on py-fuzzer recently (AKA, a Python project!) reminded me how cool our "inlay hint goto-definition feature" is. So this PR adds a bunch more of that!

I also made a couple of other minor changes to type display. For example, in the playground, this snippet:

def f(): ...
reveal_type(f.__get__)

currently leads to this diagnostic:

Revealed type: `<method-wrapper `__get__` of `f`>` (revealed-type) [Ln 2, Col 13]

But the fact that we have backticks both around the type display and inside the type display isn't great there. This PR changes it to

Revealed type: `<method-wrapper '__get__' of function 'f'>` (revealed-type) [Ln 2, Col 13]

which avoids the nested-backticks issue in diagnostics, and is more similar to our display for various other Type variants such as class-literal types (<class 'Foo'>, etc., not <class `Foo`>).

Test Plan

inlay snapshots added; mdtests updated

@AlexWaygood AlexWaygood requested a review from Gankra December 12, 2025 14:54
@AlexWaygood AlexWaygood added server Related to the LSP server ty Multi-file analysis & type inference labels Dec 12, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 12, 2025

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 12, 2025

mypy_primer results

No ecosystem changes detected ✅

No memory usage changes detected ✅

Copy link
Contributor

@Gankra Gankra left a comment

Choose a reason for hiding this comment

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

Wow, incredible!

@Gankra Gankra merged commit a722df6 into main Dec 12, 2025
42 checks passed
@Gankra Gankra deleted the alex/more-inlay-goto branch December 12, 2025 17:57
dcreager added a commit that referenced this pull request Dec 13, 2025
* origin/main: (22 commits)
  [ty] Allow gradual lower/upper bounds in a constraint set (#21957)
  [ty] disallow explicit specialization of type variables themselves (#21938)
  [ty] Improve diagnostics for unsupported binary operations and unsupported augmented assignments (#21947)
  [ty] update implicit root docs (#21955)
  [ty] Enable even more goto-definition on inlay hints (#21950)
  Document known lambda formatting deviations from Black (#21954)
  [ty] fix hover type on named expression target (#21952)
  Bump benchmark dependencies (#21951)
  Keep lambda parameters on one line and parenthesize the body if it expands (#21385)
  [ty] Improve resolution of absolute imports in tests (#21817)
  [ty] Support `__all__ += submodule.__all__`
  [ty] Change frequency of invalid `__all__` debug message
  [ty] Add `KnownUnion::to_type()` (#21948)
  [ty] Classify `cls` as class parameter (#21944)
  [ty] Stabilize rename (#21940)
  [ty] Ignore `__all__` for document and workspace symbol requests
  [ty] Attach db to background request handler task (#21941)
  [ty] Fix outdated version in publish diagnostics after `didChange` (#21943)
  [ty] avoid fixpoint unioning of types containing current-cycle Divergent (#21910)
  [ty] improve bad specialization results & error messages (#21840)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server Related to the LSP server ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants