Skip to content

Conversation

dhruvmanila
Copy link
Member

Summary

This PR changes the default of ty.inlayHints.* settings to true.

I somehow missed this in my initial PR.

This is marked as internal because it's not yet released.

@dhruvmanila dhruvmanila added internal An internal refactor or improvement configuration Related to settings and configuration server Related to the LSP server ty Multi-file analysis & type inference labels Aug 14, 2025
Copy link
Contributor

github-actions bot commented Aug 14, 2025

Diagnostic diff on typing conformance tests

Changes were detected when running ty on typing conformance tests
--- old-output.txt	2025-08-14 08:33:10.270535018 +0000
+++ new-output.txt	2025-08-14 08:33:10.336535119 +0000
@@ -1,5 +1,5 @@
 WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
-fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/918d35d/src/function/execute.rs:215:25 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(18ab)): execute: too many cycle iterations`
+fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/918d35d/src/function/execute.rs:215:25 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(48c8)): execute: too many cycle iterations`
 _directives_deprecated_library.py:15:31: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `int`
 _directives_deprecated_library.py:30:26: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `str`
 _directives_deprecated_library.py:36:41: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `Self@__add__`

Copy link
Contributor

github-actions bot commented Aug 14, 2025

mypy_primer results

No ecosystem changes detected ✅
No memory usage changes detected ✅

@dhruvmanila dhruvmanila merged commit 2ee47d8 into main Aug 14, 2025
38 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/default-inlay-hints-true branch August 14, 2025 08:42
Comment on lines +90 to +97
impl Default for InlayHintSettings {
fn default() -> Self {
Self {
variable_types: true,
function_argument_names: true,
}
}
}
Copy link
Member

@MichaReiser MichaReiser Aug 14, 2025

Choose a reason for hiding this comment

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

I'm not entirely sure about enabling all of them by default. E.g. pylance all inlays by default (which I'm also not sure if that's great). We probably want something in between where we enable the non noisy inlays by default but keep all others disabled.

Having said that. I think defaulting those two settings to true makes sense.

I assume the new default implementation matches the defaults in the VS code settings?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, good point.

I think I have it backwards. Both of them are disabled by default in Pylance.

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed in our 1:1, we've decided to keep it enabled by default, and can change it in the future before GA based on user feedback.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I'm a bit surprised by this change, and a bit unhappy with that resolution. We discussed this a fair bit as a team in the original PR adding inlay hints (#17214 (comment), and there was also discussion on Discord as well IIRC), and I thought we came to a consensus that we should keep them disabled by default

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I think I forgot about that discussion, thanks for the reminder. I'll revert this change back for now.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's a good call out that we should think about why we enable which inlays by default and we can create an issue to revisit this. In the meantime, I'd prefer to defer this discussion to later.

Copy link
Member Author

Choose a reason for hiding this comment

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

That sounds good, I can create an issue and proceed with the release as usual.

Copy link
Member

Choose a reason for hiding this comment

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

I'm afraid I'm still of the opinion that this is a change that I would definitely not want to see in my editor with what I understand the current state of this feature as being; that it would take me some time to figure out how to change the settings in VSCode (I can never find my way to the right setting on the rare occasion I need to change something); that this is going to be quite surprising to users coming from Pylance; and that this is going to negatively impact most users of the ty server.

Copy link
Member Author

@dhruvmanila dhruvmanila Aug 14, 2025

Choose a reason for hiding this comment

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

Just for context, the variable type hints were enabled by default when it got added and it only got disabled by default in #19780 which I did not intend to make. That was the main motivation of this PR which is to turn it back on to return the behavior in the released ty version.

Copy link
Member

Choose a reason for hiding this comment

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

Just for context, the variable type hints were enabled by default when it got added and it only got disabled by default in #19780 which I did not intend to make. That was the main motivation of this PR which is to turn it back on to return the behavior in the released ty version.

Ahhh, this I did not realise. I'm definitely fine with restoring the status quo, in that case, and continuing the discussion in an issue elsewhere.

dcreager added a commit that referenced this pull request Aug 14, 2025
* main:
  Feature/build riscv64 bin (#19819)
  [ty] Add caching to `CodeGeneratorKind::matches()` (#19912)
  [ty] Rename `functionArgumentNames` to `callArgumentNames` inlay hint setting (#19911)
  [ty] Default `ty.inlayHints.*` server settings to true (#19910)
  [ty] Remove py-fuzzer skips for seeds that are no longer slow (#19906)
  [ty] fix deferred name loading in PEP695 generic classes/functions (#19888)
  [ty] Add some additional type safety to `CycleDetector` (#19903)
  [`flake8-blind-except`] Fix `BLE001` false-positive on `raise ... from None` (#19755)
  [ty] resolve docstrings for modules (#19898)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration internal An internal refactor or improvement 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