mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Merge pull request #2297 from kiljacken/master
Add fancy truncation of type hints.
This commit is contained in:
commit
eec68e6f45
10 changed files with 134 additions and 35 deletions
|
@ -29,6 +29,8 @@ pub struct ServerConfig {
|
|||
|
||||
pub lru_capacity: Option<usize>,
|
||||
|
||||
pub max_inlay_hint_length: Option<usize>,
|
||||
|
||||
/// For internal usage to make integrated tests faster.
|
||||
#[serde(deserialize_with = "nullable_bool_true")]
|
||||
pub with_sysroot: bool,
|
||||
|
@ -44,6 +46,7 @@ impl Default for ServerConfig {
|
|||
exclude_globs: Vec::new(),
|
||||
use_client_watching: false,
|
||||
lru_capacity: None,
|
||||
max_inlay_hint_length: None,
|
||||
with_sysroot: true,
|
||||
feature_flags: FxHashMap::default(),
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ pub fn main_loop(
|
|||
.and_then(|it| it.folding_range.as_ref())
|
||||
.and_then(|it| it.line_folding_only)
|
||||
.unwrap_or(false),
|
||||
max_inlay_hint_length: config.max_inlay_hint_length,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -888,7 +888,7 @@ pub fn handle_inlay_hints(
|
|||
let analysis = world.analysis();
|
||||
let line_index = analysis.file_line_index(file_id)?;
|
||||
Ok(analysis
|
||||
.inlay_hints(file_id)?
|
||||
.inlay_hints(file_id, world.options.max_inlay_hint_length)?
|
||||
.into_iter()
|
||||
.map(|api_type| InlayHint {
|
||||
label: api_type.label.to_string(),
|
||||
|
|
|
@ -28,6 +28,7 @@ pub struct Options {
|
|||
pub publish_decorations: bool,
|
||||
pub supports_location_link: bool,
|
||||
pub line_folding_only: bool,
|
||||
pub max_inlay_hint_length: Option<usize>,
|
||||
}
|
||||
|
||||
/// `WorldState` is the primary mutable state of the language server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue