mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-27 20:35:09 +00:00
Address Issues from Github
- Updated naming of config - Define struct in ra_ide and use remote derive in rust-analyzer/config - Make inlayConfig type more flexible to support more future types - Remove constructor only used in tests
This commit is contained in:
parent
e98aff109a
commit
cfb48df149
10 changed files with 77 additions and 45 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1028,7 +1028,6 @@ dependencies = [
|
||||||
"ra_hir",
|
"ra_hir",
|
||||||
"ra_ide_db",
|
"ra_ide_db",
|
||||||
"ra_prof",
|
"ra_prof",
|
||||||
"ra_project_model",
|
|
||||||
"ra_syntax",
|
"ra_syntax",
|
||||||
"ra_text_edit",
|
"ra_text_edit",
|
||||||
"rand",
|
"rand",
|
||||||
|
|
|
@ -21,7 +21,6 @@ rustc-hash = "1.1.0"
|
||||||
rand = { version = "0.7.3", features = ["small_rng"] }
|
rand = { version = "0.7.3", features = ["small_rng"] }
|
||||||
|
|
||||||
ra_syntax = { path = "../ra_syntax" }
|
ra_syntax = { path = "../ra_syntax" }
|
||||||
ra_project_model = { path = "../ra_project_model" }
|
|
||||||
ra_text_edit = { path = "../ra_text_edit" }
|
ra_text_edit = { path = "../ra_text_edit" }
|
||||||
ra_db = { path = "../ra_db" }
|
ra_db = { path = "../ra_db" }
|
||||||
ra_ide_db = { path = "../ra_ide_db" }
|
ra_ide_db = { path = "../ra_ide_db" }
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use hir::{Adt, HirDisplay, Semantics, Type};
|
use hir::{Adt, HirDisplay, Semantics, Type};
|
||||||
use ra_ide_db::RootDatabase;
|
use ra_ide_db::RootDatabase;
|
||||||
use ra_prof::profile;
|
use ra_prof::profile;
|
||||||
use ra_project_model::{InlayHintDisplayType, InlayHintOptions};
|
|
||||||
use ra_syntax::{
|
use ra_syntax::{
|
||||||
ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner},
|
ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner},
|
||||||
match_ast, SmolStr, TextRange,
|
match_ast, SmolStr, TextRange,
|
||||||
|
@ -11,7 +10,19 @@ use ra_syntax::{
|
||||||
|
|
||||||
use crate::{FileId, FunctionSignature};
|
use crate::{FileId, FunctionSignature};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
|
pub struct InlayConfig {
|
||||||
|
pub display_type: Vec<InlayKind>,
|
||||||
|
pub max_length: Option<usize>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for InlayConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self { display_type: vec![InlayKind::TypeHint, InlayKind::ParameterHint], max_length: None }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum InlayKind {
|
pub enum InlayKind {
|
||||||
TypeHint,
|
TypeHint,
|
||||||
ParameterHint,
|
ParameterHint,
|
||||||
|
@ -27,7 +38,7 @@ pub struct InlayHint {
|
||||||
pub(crate) fn inlay_hints(
|
pub(crate) fn inlay_hints(
|
||||||
db: &RootDatabase,
|
db: &RootDatabase,
|
||||||
file_id: FileId,
|
file_id: FileId,
|
||||||
inlay_hint_opts: &InlayHintOptions,
|
inlay_hint_opts: &InlayConfig,
|
||||||
) -> Vec<InlayHint> {
|
) -> Vec<InlayHint> {
|
||||||
let _p = profile("inlay_hints");
|
let _p = profile("inlay_hints");
|
||||||
let sema = Semantics::new(db);
|
let sema = Semantics::new(db);
|
||||||
|
@ -50,12 +61,11 @@ pub(crate) fn inlay_hints(
|
||||||
fn get_param_name_hints(
|
fn get_param_name_hints(
|
||||||
acc: &mut Vec<InlayHint>,
|
acc: &mut Vec<InlayHint>,
|
||||||
sema: &Semantics<RootDatabase>,
|
sema: &Semantics<RootDatabase>,
|
||||||
inlay_hint_opts: &InlayHintOptions,
|
inlay_hint_opts: &InlayConfig,
|
||||||
expr: ast::Expr,
|
expr: ast::Expr,
|
||||||
) -> Option<()> {
|
) -> Option<()> {
|
||||||
match inlay_hint_opts.display_type {
|
if !inlay_hint_opts.display_type.contains(&InlayKind::ParameterHint) {
|
||||||
InlayHintDisplayType::Off | InlayHintDisplayType::TypeHints => return None,
|
return None;
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let args = match &expr {
|
let args = match &expr {
|
||||||
|
@ -91,12 +101,11 @@ fn get_param_name_hints(
|
||||||
fn get_bind_pat_hints(
|
fn get_bind_pat_hints(
|
||||||
acc: &mut Vec<InlayHint>,
|
acc: &mut Vec<InlayHint>,
|
||||||
sema: &Semantics<RootDatabase>,
|
sema: &Semantics<RootDatabase>,
|
||||||
inlay_hint_opts: &InlayHintOptions,
|
inlay_hint_opts: &InlayConfig,
|
||||||
pat: ast::BindPat,
|
pat: ast::BindPat,
|
||||||
) -> Option<()> {
|
) -> Option<()> {
|
||||||
match inlay_hint_opts.display_type {
|
if !inlay_hint_opts.display_type.contains(&InlayKind::TypeHint) {
|
||||||
InlayHintDisplayType::Off | InlayHintDisplayType::ParameterHints => return None,
|
return None;
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let ty = sema.type_of_pat(&pat.clone().into())?;
|
let ty = sema.type_of_pat(&pat.clone().into())?;
|
||||||
|
@ -214,10 +223,10 @@ fn get_fn_signature(sema: &Semantics<RootDatabase>, expr: &ast::Expr) -> Option<
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use crate::inlay_hints::{InlayConfig, InlayKind};
|
||||||
use insta::assert_debug_snapshot;
|
use insta::assert_debug_snapshot;
|
||||||
|
|
||||||
use crate::mock_analysis::single_file;
|
use crate::mock_analysis::single_file;
|
||||||
use ra_project_model::{InlayHintDisplayType, InlayHintOptions};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn param_hints_only() {
|
fn param_hints_only() {
|
||||||
|
@ -228,7 +237,7 @@ mod tests {
|
||||||
let _x = foo(4, 4);
|
let _x = foo(4, 4);
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions{ display_type: InlayHintDisplayType::ParameterHints, max_length: None}).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig{ display_type: vec![InlayKind::ParameterHint], max_length: None}).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [106; 107),
|
range: [106; 107),
|
||||||
|
@ -252,7 +261,7 @@ mod tests {
|
||||||
let _x = foo(4, 4);
|
let _x = foo(4, 4);
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions{ display_type: InlayHintDisplayType::Off, max_length: None}).unwrap(), @r###"[]"###);
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig{ display_type: vec![], max_length: None}).unwrap(), @r###"[]"###);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -264,7 +273,7 @@ mod tests {
|
||||||
let _x = foo(4, 4);
|
let _x = foo(4, 4);
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions{ display_type: InlayHintDisplayType::TypeHints, max_length: None}).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig{ display_type: vec![InlayKind::TypeHint], max_length: None}).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [97; 99),
|
range: [97; 99),
|
||||||
|
@ -288,7 +297,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [69; 71),
|
range: [69; 71),
|
||||||
|
@ -345,7 +354,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [193; 197),
|
range: [193; 197),
|
||||||
|
@ -425,7 +434,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [21; 30),
|
range: [21; 30),
|
||||||
|
@ -489,7 +498,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [21; 30),
|
range: [21; 30),
|
||||||
|
@ -539,7 +548,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [188; 192),
|
range: [188; 192),
|
||||||
|
@ -634,7 +643,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [188; 192),
|
range: [188; 192),
|
||||||
|
@ -729,7 +738,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [252; 256),
|
range: [252; 256),
|
||||||
|
@ -801,7 +810,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(Some(8))).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig { display_type: vec![InlayKind::TypeHint, InlayKind::ParameterHint], max_length: Some(8) }).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [74; 75),
|
range: [74; 75),
|
||||||
|
@ -889,7 +898,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###"
|
||||||
[
|
[
|
||||||
InlayHint {
|
InlayHint {
|
||||||
range: [798; 809),
|
range: [798; 809),
|
||||||
|
@ -1011,7 +1020,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(Some(8))).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig { display_type: vec![InlayKind::TypeHint, InlayKind::ParameterHint], max_length: Some(8) }).unwrap(), @r###"
|
||||||
[]
|
[]
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
@ -1037,7 +1046,7 @@ fn main() {
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(Some(8))).unwrap(), @r###"
|
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig { display_type: vec![InlayKind::TypeHint, InlayKind::ParameterHint], max_length: Some(8) }).unwrap(), @r###"
|
||||||
[]
|
[]
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
|
@ -44,7 +44,6 @@ mod marks;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_utils;
|
mod test_utils;
|
||||||
|
|
||||||
use ra_project_model::InlayHintOptions;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ra_cfg::CfgOptions;
|
use ra_cfg::CfgOptions;
|
||||||
|
@ -69,7 +68,7 @@ pub use crate::{
|
||||||
expand_macro::ExpandedMacro,
|
expand_macro::ExpandedMacro,
|
||||||
folding_ranges::{Fold, FoldKind},
|
folding_ranges::{Fold, FoldKind},
|
||||||
hover::HoverResult,
|
hover::HoverResult,
|
||||||
inlay_hints::{InlayHint, InlayKind},
|
inlay_hints::{InlayConfig, InlayHint, InlayKind},
|
||||||
references::{Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult},
|
references::{Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult},
|
||||||
runnables::{Runnable, RunnableKind, TestId},
|
runnables::{Runnable, RunnableKind, TestId},
|
||||||
source_change::{FileSystemEdit, SourceChange, SourceFileEdit},
|
source_change::{FileSystemEdit, SourceChange, SourceFileEdit},
|
||||||
|
@ -319,7 +318,7 @@ impl Analysis {
|
||||||
pub fn inlay_hints(
|
pub fn inlay_hints(
|
||||||
&self,
|
&self,
|
||||||
file_id: FileId,
|
file_id: FileId,
|
||||||
inlay_hint_opts: &InlayHintOptions,
|
inlay_hint_opts: &InlayConfig,
|
||||||
) -> Cancelable<Vec<InlayHint>> {
|
) -> Cancelable<Vec<InlayHint>> {
|
||||||
self.with_db(|db| inlay_hints::inlay_hints(db, file_id, inlay_hint_opts))
|
self.with_db(|db| inlay_hints::inlay_hints(db, file_id, inlay_hint_opts))
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,6 @@ pub struct InlayHintOptions {
|
||||||
pub max_length: Option<usize>,
|
pub max_length: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InlayHintOptions {
|
|
||||||
pub fn new(max_length: Option<usize>) -> Self {
|
|
||||||
Self { display_type: InlayHintDisplayType::Full, max_length }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for InlayHintOptions {
|
impl Default for InlayHintOptions {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self { display_type: InlayHintDisplayType::Full, max_length: None }
|
Self { display_type: InlayHintDisplayType::Full, max_length: None }
|
||||||
|
|
|
@ -7,12 +7,40 @@
|
||||||
//! configure the server itself, feature flags are passed into analysis, and
|
//! configure the server itself, feature flags are passed into analysis, and
|
||||||
//! tweak things like automatic insertion of `()` in completions.
|
//! tweak things like automatic insertion of `()` in completions.
|
||||||
|
|
||||||
use ra_project_model::InlayHintOptions;
|
use ra_ide::{InlayConfig, InlayKind};
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
|
|
||||||
use ra_project_model::CargoFeatures;
|
use ra_project_model::CargoFeatures;
|
||||||
use serde::{Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer};
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(remote = "InlayKind")]
|
||||||
|
pub enum InlayKindDef {
|
||||||
|
TypeHint,
|
||||||
|
ParameterHint,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Work-around until better serde support is added
|
||||||
|
// https://github.com/serde-rs/serde/issues/723#issuecomment-382501277
|
||||||
|
fn vec_inlay_kind<'de, D>(deserializer: D) -> Result<Vec<InlayKind>, D::Error>
|
||||||
|
where
|
||||||
|
D: Deserializer<'de>,
|
||||||
|
{
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct Wrapper(#[serde(with = "InlayKindDef")] InlayKind);
|
||||||
|
|
||||||
|
let v = Vec::deserialize(deserializer)?;
|
||||||
|
Ok(v.into_iter().map(|Wrapper(a)| a).collect())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(remote = "InlayConfig")]
|
||||||
|
pub struct InlayConfigDef {
|
||||||
|
#[serde(deserialize_with = "vec_inlay_kind")]
|
||||||
|
pub display_type: Vec<InlayKind>,
|
||||||
|
pub max_length: Option<usize>,
|
||||||
|
}
|
||||||
|
|
||||||
/// Client provided initialization options
|
/// Client provided initialization options
|
||||||
#[derive(Deserialize, Clone, Debug, PartialEq, Eq)]
|
#[derive(Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
#[serde(rename_all = "camelCase", default)]
|
#[serde(rename_all = "camelCase", default)]
|
||||||
|
@ -31,7 +59,8 @@ pub struct ServerConfig {
|
||||||
|
|
||||||
pub lru_capacity: Option<usize>,
|
pub lru_capacity: Option<usize>,
|
||||||
|
|
||||||
pub inlay_hint_opts: InlayHintOptions,
|
#[serde(with = "InlayConfigDef")]
|
||||||
|
pub inlay_hint_opts: InlayConfig,
|
||||||
|
|
||||||
pub cargo_watch_enable: bool,
|
pub cargo_watch_enable: bool,
|
||||||
pub cargo_watch_args: Vec<String>,
|
pub cargo_watch_args: Vec<String>,
|
||||||
|
|
|
@ -177,7 +177,7 @@ pub fn main_loop(
|
||||||
.and_then(|it| it.folding_range.as_ref())
|
.and_then(|it| it.folding_range.as_ref())
|
||||||
.and_then(|it| it.line_folding_only)
|
.and_then(|it| it.line_folding_only)
|
||||||
.unwrap_or(false),
|
.unwrap_or(false),
|
||||||
inlay_hint_opts: config.inlay_hint_opts.clone(),
|
inlay_hint_opts: config.inlay_hint_opts,
|
||||||
cargo_watch: CheckOptions {
|
cargo_watch: CheckOptions {
|
||||||
enable: config.cargo_watch_enable,
|
enable: config.cargo_watch_enable,
|
||||||
args: config.cargo_watch_args,
|
args: config.cargo_watch_args,
|
||||||
|
|
|
@ -997,7 +997,7 @@ pub fn handle_inlay_hints(
|
||||||
let analysis = world.analysis();
|
let analysis = world.analysis();
|
||||||
let line_index = analysis.file_line_index(file_id)?;
|
let line_index = analysis.file_line_index(file_id)?;
|
||||||
Ok(analysis
|
Ok(analysis
|
||||||
.inlay_hints(file_id, world.options.max_inlay_hint_length)?
|
.inlay_hints(file_id, &world.options.inlay_hint_opts)?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|api_type| InlayHint {
|
.map(|api_type| InlayHint {
|
||||||
label: api_type.label.to_string(),
|
label: api_type.label.to_string(),
|
||||||
|
|
|
@ -13,9 +13,10 @@ use lsp_types::Url;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use ra_cargo_watch::{url_from_path_with_drive_lowercasing, CheckOptions, CheckWatcher};
|
use ra_cargo_watch::{url_from_path_with_drive_lowercasing, CheckOptions, CheckWatcher};
|
||||||
use ra_ide::{
|
use ra_ide::{
|
||||||
Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, SourceRootId,
|
Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, InlayConfig, LibraryData,
|
||||||
|
SourceRootId,
|
||||||
};
|
};
|
||||||
use ra_project_model::{get_rustc_cfg_options, InlayHintOptions, ProjectWorkspace};
|
use ra_project_model::{get_rustc_cfg_options, ProjectWorkspace};
|
||||||
use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot, VfsTask, Watch};
|
use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot, VfsTask, Watch};
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ pub struct Options {
|
||||||
pub publish_decorations: bool,
|
pub publish_decorations: bool,
|
||||||
pub supports_location_link: bool,
|
pub supports_location_link: bool,
|
||||||
pub line_folding_only: bool,
|
pub line_folding_only: bool,
|
||||||
pub inlay_hint_opts: InlayHintOptions,
|
pub inlay_hint_opts: InlayConfig,
|
||||||
pub rustfmt_args: Vec<String>,
|
pub rustfmt_args: Vec<String>,
|
||||||
pub cargo_watch: CheckOptions,
|
pub cargo_watch: CheckOptions,
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,9 @@ export class Config {
|
||||||
private static readonly requiresReloadOpts = [
|
private static readonly requiresReloadOpts = [
|
||||||
"cargoFeatures",
|
"cargoFeatures",
|
||||||
"cargo-watch",
|
"cargo-watch",
|
||||||
"highlighting.semanticTokens"
|
"highlighting.semanticTokens",
|
||||||
|
"inlayHintOpts.maxLength",
|
||||||
|
"inlayHintOpts.displayType",
|
||||||
]
|
]
|
||||||
.map(opt => `${Config.rootSection}.${opt}`);
|
.map(opt => `${Config.rootSection}.${opt}`);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue