Skip to content

Conversation

A4-Tacks
Copy link
Contributor

  • Support else completion in ArrayExpr, ReturnExpr and PrefixExpr etc
  • Support else completion after MatchArm expression

Before this PR, the else branch could not be completed in most expressions

Example

fn foo() -> [i32; 1] {
    [if true {
        2
    } $0]
}

->

fn foo() -> [i32; 1] {
    [if true {
        2
    } else {
        $0
    }]
}

fn foo() -> i32 {
    match () {
        () => if true {
            2
        } $0
    }
}

->

fn foo() -> i32 {
    match () {
        () => if true {
            2
        } else {
            $0
        }
    }
}

- Support else completion in ArrayExpr, ReturnExpr and PrefixExpr etc
- Support else completion after MatchArm expression

Before this PR, the else branch could not be completed in most expressions

Example
---
```rust
fn foo() -> [i32; 1] {
    [if true {
        2
    } $0]
}
```
->
```rust
fn foo() -> [i32; 1] {
    [if true {
        2
    } else {
        $0
    }]
}
```

---

```rust
fn foo() -> i32 {
    match () {
        () => if true {
            2
        } $0
    }
}
```
->
```rust
fn foo() -> i32 {
    match () {
        () => if true {
            2
        } else {
            $0
        }
    }
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants