diff options
-rw-r--r-- | crates/proc_macro_api/src/rpc.rs | 30 | ||||
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 4 | ||||
-rw-r--r-- | docs/user/generated_config.adoc | 4 | ||||
-rw-r--r-- | editors/code/package.json | 4 |
4 files changed, 32 insertions, 10 deletions
diff --git a/crates/proc_macro_api/src/rpc.rs b/crates/proc_macro_api/src/rpc.rs index 9a68e2cc5..8f7270afe 100644 --- a/crates/proc_macro_api/src/rpc.rs +++ b/crates/proc_macro_api/src/rpc.rs | |||
@@ -77,7 +77,11 @@ struct TokenIdDef(u32); | |||
77 | #[derive(Serialize, Deserialize)] | 77 | #[derive(Serialize, Deserialize)] |
78 | #[serde(remote = "Delimiter")] | 78 | #[serde(remote = "Delimiter")] |
79 | struct DelimiterDef { | 79 | struct DelimiterDef { |
80 | #[serde(with = "TokenIdDef")] | 80 | #[serde( |
81 | with = "TokenIdDef", | ||
82 | default = "tt::TokenId::unspecified", | ||
83 | skip_serializing_if = "token_id_def::skip_if" | ||
84 | )] | ||
81 | id: TokenId, | 85 | id: TokenId, |
82 | #[serde(with = "DelimiterKindDef")] | 86 | #[serde(with = "DelimiterKindDef")] |
83 | kind: DelimiterKind, | 87 | kind: DelimiterKind, |
@@ -116,7 +120,11 @@ enum LeafDef { | |||
116 | #[serde(remote = "Literal")] | 120 | #[serde(remote = "Literal")] |
117 | struct LiteralDef { | 121 | struct LiteralDef { |
118 | text: SmolStr, | 122 | text: SmolStr, |
119 | #[serde(with = "TokenIdDef")] | 123 | #[serde( |
124 | with = "TokenIdDef", | ||
125 | default = "tt::TokenId::unspecified", | ||
126 | skip_serializing_if = "token_id_def::skip_if" | ||
127 | )] | ||
120 | id: TokenId, | 128 | id: TokenId, |
121 | } | 129 | } |
122 | 130 | ||
@@ -126,7 +134,11 @@ struct PunctDef { | |||
126 | char: char, | 134 | char: char, |
127 | #[serde(with = "SpacingDef")] | 135 | #[serde(with = "SpacingDef")] |
128 | spacing: Spacing, | 136 | spacing: Spacing, |
129 | #[serde(with = "TokenIdDef")] | 137 | #[serde( |
138 | with = "TokenIdDef", | ||
139 | default = "tt::TokenId::unspecified", | ||
140 | skip_serializing_if = "token_id_def::skip_if" | ||
141 | )] | ||
130 | id: TokenId, | 142 | id: TokenId, |
131 | } | 143 | } |
132 | 144 | ||
@@ -141,10 +153,20 @@ enum SpacingDef { | |||
141 | #[serde(remote = "Ident")] | 153 | #[serde(remote = "Ident")] |
142 | struct IdentDef { | 154 | struct IdentDef { |
143 | text: SmolStr, | 155 | text: SmolStr, |
144 | #[serde(with = "TokenIdDef")] | 156 | #[serde( |
157 | with = "TokenIdDef", | ||
158 | default = "tt::TokenId::unspecified", | ||
159 | skip_serializing_if = "token_id_def::skip_if" | ||
160 | )] | ||
145 | id: TokenId, | 161 | id: TokenId, |
146 | } | 162 | } |
147 | 163 | ||
164 | mod token_id_def { | ||
165 | pub(super) fn skip_if(value: &tt::TokenId) -> bool { | ||
166 | *value == tt::TokenId::unspecified() | ||
167 | } | ||
168 | } | ||
169 | |||
148 | mod opt_delimiter_def { | 170 | mod opt_delimiter_def { |
149 | use super::{Delimiter, DelimiterDef}; | 171 | use super::{Delimiter, DelimiterDef}; |
150 | use serde::{Deserialize, Deserializer, Serialize, Serializer}; | 172 | use serde::{Deserialize, Deserializer, Serialize, Serializer}; |
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 5c88c3a9b..cda272fd4 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -131,8 +131,8 @@ config_data! { | |||
131 | 131 | ||
132 | /// Whether to show inlay type hints for method chains. | 132 | /// Whether to show inlay type hints for method chains. |
133 | inlayHints_chainingHints: bool = "true", | 133 | inlayHints_chainingHints: bool = "true", |
134 | /// Maximum length for inlay hints. Default is unlimited. | 134 | /// Maximum length for inlay hints. Set to null to have an unlimited length. |
135 | inlayHints_maxLength: Option<usize> = "null", | 135 | inlayHints_maxLength: Option<usize> = "25", |
136 | /// Whether to show function parameter name inlay hints at the call | 136 | /// Whether to show function parameter name inlay hints at the call |
137 | /// site. | 137 | /// site. |
138 | inlayHints_parameterHints: bool = "true", | 138 | inlayHints_parameterHints: bool = "true", |
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc index c2521289c..871c65add 100644 --- a/docs/user/generated_config.adoc +++ b/docs/user/generated_config.adoc | |||
@@ -206,10 +206,10 @@ Use markdown syntax for links in hover. | |||
206 | -- | 206 | -- |
207 | Whether to show inlay type hints for method chains. | 207 | Whether to show inlay type hints for method chains. |
208 | -- | 208 | -- |
209 | [[rust-analyzer.inlayHints.maxLength]]rust-analyzer.inlayHints.maxLength (default: `null`):: | 209 | [[rust-analyzer.inlayHints.maxLength]]rust-analyzer.inlayHints.maxLength (default: `25`):: |
210 | + | 210 | + |
211 | -- | 211 | -- |
212 | Maximum length for inlay hints. Default is unlimited. | 212 | Maximum length for inlay hints. Set to null to have an unlimited length. |
213 | -- | 213 | -- |
214 | [[rust-analyzer.inlayHints.parameterHints]]rust-analyzer.inlayHints.parameterHints (default: `true`):: | 214 | [[rust-analyzer.inlayHints.parameterHints]]rust-analyzer.inlayHints.parameterHints (default: `true`):: |
215 | + | 215 | + |
diff --git a/editors/code/package.json b/editors/code/package.json index faec45276..d263610f5 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -625,8 +625,8 @@ | |||
625 | "type": "boolean" | 625 | "type": "boolean" |
626 | }, | 626 | }, |
627 | "rust-analyzer.inlayHints.maxLength": { | 627 | "rust-analyzer.inlayHints.maxLength": { |
628 | "markdownDescription": "Maximum length for inlay hints. Default is unlimited.", | 628 | "markdownDescription": "Maximum length for inlay hints. Set to null to have an unlimited length.", |
629 | "default": null, | 629 | "default": 25, |
630 | "type": [ | 630 | "type": [ |
631 | "null", | 631 | "null", |
632 | "integer" | 632 | "integer" |