Skip to content

[ty] suppress type inlay hints for leading-underscore assignments#22855

Merged
AlexWaygood merged 1 commit intoastral-sh:mainfrom
Hugo-Polloli:inlay-hints-suppression
Jan 26, 2026
Merged

[ty] suppress type inlay hints for leading-underscore assignments#22855
AlexWaygood merged 1 commit intoastral-sh:mainfrom
Hugo-Polloli:inlay-hints-suppression

Conversation

@Hugo-Polloli
Copy link
Contributor

@Hugo-Polloli Hugo-Polloli commented Jan 26, 2026

Summary

Ref : astral-sh/ty#2610 (at least as a first iteration of the feature, non-configurable for now)

Suppress type inlay hints for assignments to leading-underscore names to reduce noise, while allowing dunder assignments to keep their hints. Add snapshot tests to cover simple assignments and tuple unpacking

Test Plan

Used cargo insta to generate snapshot tests for:

  • Leading-underscore assignments (_, _ignored, __ignored) produce no type inlay hints
  • Tuple assignments only suppress hints on leading-underscore targets, not on other targets
  • Dunder assignment (eg. __special__) still shows a type inlay hint
image

@Hugo-Polloli Hugo-Polloli marked this pull request as ready for review January 26, 2026 00:41
@ntBre ntBre added the ty Multi-file analysis & type inference label Jan 26, 2026
@AlexWaygood AlexWaygood added the server Related to the LSP server label Jan 26, 2026
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Perfect, thank you!

@AlexWaygood AlexWaygood merged commit 553e9a0 into astral-sh:main Jan 26, 2026
47 checks passed
@Hugo-Polloli Hugo-Polloli deleted the inlay-hints-suppression branch March 1, 2026 09:12
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.

3 participants