Skip to content

fix: don't add a second semicolon after postfix completions#21839

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
A4-Tacks:dedup-comp-postfix-let-semi
Mar 20, 2026
Merged

fix: don't add a second semicolon after postfix completions#21839
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
A4-Tacks:dedup-comp-postfix-let-semi

Conversation

@A4-Tacks
Copy link
Member

Make .let .letm .return .break not duplicate semicolons

Example

fn main() {
    baz.l$0;
}

Before this PR

fn main() {
    let $0 = baz;;
}

After this PR

fn main() {
    let $0 = baz;
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 18, 2026
Make `.let` `.letm` `.return` `.break` not duplicate semicolons

Example
---
```rust
fn main() {
    baz.l$0;
}
```

**Before this PR**

```rust
fn main() {
    let $0 = baz;;
}
```

**After this PR**

```rust
fn main() {
    let $0 = baz;
}
```
@A4-Tacks A4-Tacks force-pushed the dedup-comp-postfix-let-semi branch from 862f769 to 88a2710 Compare March 18, 2026 11:57
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of all the nice changes you're making currently to the let postfix completion, any chance you do the same for the non-postfix let?

Thanks anyway, of course!

View changes since this review

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Mar 20, 2026
Merged via the queue into rust-lang:master with commit 6cc43ef Mar 20, 2026
17 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 20, 2026
@A4-Tacks
Copy link
Member Author

for the non-postfix let?

Is it used for the skill of entering semicolons first and then let in some macros?

@ChayimFriedman2
Copy link
Contributor

AFAIK it inserts let $0 = ;.

@lnicola lnicola changed the title fix: .let no complete semicolon before semicolon fix: don't add a second semicolon after postfix completions Mar 20, 2026
@A4-Tacks A4-Tacks deleted the dedup-comp-postfix-let-semi branch March 20, 2026 10:45
@A4-Tacks
Copy link
Member Author

Are you referring to situations like le$0expr();?

This is quite difficult to handle. The expression snippets are relatively simple, so it's better to use expr().le$0;

@ChayimFriedman2
Copy link
Contributor

No, I'm referring to e.g. typing let inside a match arm, it will be nice if it would open a block.

@A4-Tacks
Copy link
Member Author

Isn't this #21594? And the expression snippets are all hard coded short snippets, without perceiving the surrounding syntax tree, right

@ChayimFriedman2
Copy link
Contributor

#21594 was about the postfix snippet, which I'm unused to use, therefore I'm requesting you to do it for non-postfix snippets as well :)

@A4-Tacks
Copy link
Member Author

However, technically, non-postfix snippets (expressions snippets) are difficult to implement this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants