diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-06 17:50:49 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-06 17:50:49 +0100 |
commit | 7e12422fa2c8ba7b3df63b4e4297464a0071a359 (patch) | |
tree | f88de34c48e08ea8cf481a29f5764f13492a9ac9 /crates/ra_lsp_server | |
parent | 811492aa546d83daf56f61d334d6ee295651f111 (diff) | |
parent | c5598d9ade92e9ec4474a14229bb34a44a4edad5 (diff) |
Merge #1652
1652: Improve type hints behavior r=matklad a=SomeoneToIgnore
This PR fixed the following type hints issues:
* Restructures the `InlayKind` enum contents based on the discussion here: https://github.com/rust-analyzer/rust-analyzer/pull/1606#issuecomment-515968055
* Races described in #1639
* Caches the latest decorations received for each file to show them the next time the file is opened (instead of a new server request)
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 9 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/req.rs | 7 |
2 files changed, 2 insertions, 14 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 005ce08b3..686ee5d12 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -885,14 +885,7 @@ pub fn handle_inlay_hints( | |||
885 | label: api_type.label.to_string(), | 885 | label: api_type.label.to_string(), |
886 | range: api_type.range.conv_with(&line_index), | 886 | range: api_type.range.conv_with(&line_index), |
887 | kind: match api_type.kind { | 887 | kind: match api_type.kind { |
888 | ra_ide_api::InlayKind::LetBindingType => InlayKind::LetBindingType, | 888 | ra_ide_api::InlayKind::TypeHint => InlayKind::TypeHint, |
889 | ra_ide_api::InlayKind::ClosureParameterType => InlayKind::ClosureParameterType, | ||
890 | ra_ide_api::InlayKind::ForExpressionBindingType => { | ||
891 | InlayKind::ForExpressionBindingType | ||
892 | } | ||
893 | ra_ide_api::InlayKind::IfExpressionType => InlayKind::IfExpressionType, | ||
894 | ra_ide_api::InlayKind::WhileLetExpressionType => InlayKind::WhileLetExpressionType, | ||
895 | ra_ide_api::InlayKind::MatchArmType => InlayKind::MatchArmType, | ||
896 | }, | 889 | }, |
897 | }) | 890 | }) |
898 | .collect()) | 891 | .collect()) |
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs index 570438643..6b986bcc9 100644 --- a/crates/ra_lsp_server/src/req.rs +++ b/crates/ra_lsp_server/src/req.rs | |||
@@ -213,12 +213,7 @@ pub struct InlayHintsParams { | |||
213 | 213 | ||
214 | #[derive(Debug, PartialEq, Eq, Deserialize, Serialize)] | 214 | #[derive(Debug, PartialEq, Eq, Deserialize, Serialize)] |
215 | pub enum InlayKind { | 215 | pub enum InlayKind { |
216 | LetBindingType, | 216 | TypeHint, |
217 | ClosureParameterType, | ||
218 | ForExpressionBindingType, | ||
219 | IfExpressionType, | ||
220 | WhileLetExpressionType, | ||
221 | MatchArmType, | ||
222 | } | 217 | } |
223 | 218 | ||
224 | #[derive(Debug, Deserialize, Serialize)] | 219 | #[derive(Debug, Deserialize, Serialize)] |