[ty] Add ty.inlayHints.variableTypes server option (#19780)

## Summary

This PR adds a new `ty.inlayHints.variableTypes` server setting to
configure ty to include / exclude inlay hints at variable position.

Currently, we only support inlay hints at this position so this option
basically translates to enabling / disabling inlay hints for now :)

The VS Code extension PR is
https://github.com/astral-sh/ty-vscode/pull/112.

closes: astral-sh/ty#472

## Test Plan

Add E2E tests.
This commit is contained in:
Dhruv Manilawala 2025-08-07 19:16:51 +05:30 committed by GitHub
parent c401a6d86e
commit b22586fa0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 181 additions and 20 deletions

View file

@ -16,8 +16,8 @@ use ruff_python_formatter::formatted_file;
use ruff_source_file::{LineIndex, OneIndexed, SourceLocation};
use ruff_text_size::{Ranged, TextSize};
use ty_ide::{
MarkupKind, RangedValue, document_highlights, goto_declaration, goto_definition,
goto_references, goto_type_definition, hover, inlay_hints,
InlayHintSettings, MarkupKind, RangedValue, document_highlights, goto_declaration,
goto_definition, goto_references, goto_type_definition, hover, inlay_hints,
};
use ty_ide::{NavigationTargets, signature_help};
use ty_project::metadata::options::Options;
@ -435,6 +435,10 @@ impl Workspace {
&self.db,
file_id.file,
range.to_text_range(&index, &source, self.position_encoding)?,
// TODO: Provide a way to configure this
&InlayHintSettings {
variable_types: true,
},
);
Ok(result