mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-28 02:39:59 +00:00
[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:
parent
c401a6d86e
commit
b22586fa0e
8 changed files with 181 additions and 20 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue