aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-29 13:30:39 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-29 13:30:39 +0100
commitbf1369cdef1b11ce7ba3a289ae6c4187b6fa5854 (patch)
tree8df5bee4253cc9f170e2f324062d274871c942bc /crates/ra_lsp_server
parent62bdcc0fb2015116316d47d665d504cbe666aaed (diff)
parentb8f95f42e1777d3858c74b45ba8f7a5b5a3cdca8 (diff)
Merge #1606
1606: Add `if let`, `while let` and match arm inlay hints r=matklad a=SomeoneToIgnore <img width="693" alt="image" src="https://user-images.githubusercontent.com/2690773/62013363-152f1d80-b19a-11e9-90ea-07568757baa2.png"> Add more inline hints support. Looks like `while let` type inference support is missing currently, so the corresponding hint tests lack the actual results. I've also could not find a good way to distinguish between `a` and `b` pats in the following expressions: `if let Some(Test { a: None, b: y }) = &test {};` In this case we don't need to add a hint for first pat (`a: None`), since it's matched against the particular enum variant and need a hint for `y`, since it's a new variable. But both `a` and `b` are `BIND_PAT` with similar contents, so looks like there's nothing I can check for to find any differences. I don't display any hints for such cases now, to avoid confusion, but would be nice to know if there's a way to fix this behavior. 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.rs3
-rw-r--r--crates/ra_lsp_server/src/req.rs3
2 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 0b4493ce2..9006aa316 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -900,6 +900,9 @@ pub fn handle_inlay_hints(
900 ra_ide_api::InlayKind::ForExpressionBindingType => { 900 ra_ide_api::InlayKind::ForExpressionBindingType => {
901 InlayKind::ForExpressionBindingType 901 InlayKind::ForExpressionBindingType
902 } 902 }
903 ra_ide_api::InlayKind::IfExpressionType => InlayKind::IfExpressionType,
904 ra_ide_api::InlayKind::WhileLetExpressionType => InlayKind::WhileLetExpressionType,
905 ra_ide_api::InlayKind::MatchArmType => InlayKind::MatchArmType,
903 }, 906 },
904 }) 907 })
905 .collect()) 908 .collect())
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs
index 96f6b1bc5..570438643 100644
--- a/crates/ra_lsp_server/src/req.rs
+++ b/crates/ra_lsp_server/src/req.rs
@@ -216,6 +216,9 @@ pub enum InlayKind {
216 LetBindingType, 216 LetBindingType,
217 ClosureParameterType, 217 ClosureParameterType,
218 ForExpressionBindingType, 218 ForExpressionBindingType,
219 IfExpressionType,
220 WhileLetExpressionType,
221 MatchArmType,
219} 222}
220 223
221#[derive(Debug, Deserialize, Serialize)] 224#[derive(Debug, Deserialize, Serialize)]