diff options
-rw-r--r-- | crates/ra_assists/src/handlers/invert_if.rs | 13 | ||||
-rw-r--r-- | editors/code/src/inlay_hints.ts | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/crates/ra_assists/src/handlers/invert_if.rs b/crates/ra_assists/src/handlers/invert_if.rs index 3a2665d17..4c5716868 100644 --- a/crates/ra_assists/src/handlers/invert_if.rs +++ b/crates/ra_assists/src/handlers/invert_if.rs | |||
@@ -33,6 +33,11 @@ pub(crate) fn invert_if(ctx: AssistCtx) -> Option<Assist> { | |||
33 | return None; | 33 | return None; |
34 | } | 34 | } |
35 | 35 | ||
36 | // This assist should not apply for if-let. | ||
37 | if expr.condition()?.pat().is_some() { | ||
38 | return None; | ||
39 | } | ||
40 | |||
36 | let cond = expr.condition()?.expr()?; | 41 | let cond = expr.condition()?.expr()?; |
37 | let then_node = expr.then_branch()?.syntax().clone(); | 42 | let then_node = expr.then_branch()?.syntax().clone(); |
38 | 43 | ||
@@ -90,4 +95,12 @@ mod tests { | |||
90 | fn invert_if_doesnt_apply_with_cursor_not_on_if() { | 95 | fn invert_if_doesnt_apply_with_cursor_not_on_if() { |
91 | check_assist_not_applicable(invert_if, "fn f() { if !<|>cond { 3 * 2 } else { 1 } }") | 96 | check_assist_not_applicable(invert_if, "fn f() { if !<|>cond { 3 * 2 } else { 1 } }") |
92 | } | 97 | } |
98 | |||
99 | #[test] | ||
100 | fn invert_if_doesnt_apply_with_if_let() { | ||
101 | check_assist_not_applicable( | ||
102 | invert_if, | ||
103 | "fn f() { i<|>f let Some(_) = Some(1) { 1 } else { 0 } }", | ||
104 | ) | ||
105 | } | ||
93 | } | 106 | } |
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index b19b09ad5..17d0dfa33 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts | |||
@@ -134,8 +134,6 @@ class HintsUpdater implements Disposable { | |||
134 | 134 | ||
135 | // No text documents changed, so we may try to use the cache | 135 | // No text documents changed, so we may try to use the cache |
136 | if (!file.cachedDecorations) { | 136 | if (!file.cachedDecorations) { |
137 | file.inlaysRequest?.cancel(); | ||
138 | |||
139 | const hints = await this.fetchHints(file); | 137 | const hints = await this.fetchHints(file); |
140 | if (!hints) return; | 138 | if (!hints) return; |
141 | 139 | ||