Skip to content

Conversation

@A4-Tacks
Copy link
Member

@A4-Tacks A4-Tacks commented Dec 17, 2025

Close #21292

Example

fn f() -> i32 {
    if true {
        $0
    }
}

addSemicolonToJumps: true (default)

fn f() -> i32 {
    if true {
        return $0;
    }
}

addSemicolonToJumps: false

fn f() -> i32 {
    if true {
        return $0
    }
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 17, 2025
@ChayimFriedman2
Copy link
Contributor

ChayimFriedman2 commented Dec 17, 2025

I don't think we should have so specific config, rather I'd prefer a config like completion.plainKeywords to complete all keywords without extra things (no let = etc.), or even "completion.keyword": "smart" | "plain" | "none" to also support #21101.

@A4-Tacks
Copy link
Member Author

This is not disabling keyword completion, but removing semicolons from the results

I don't think we should have so specific config

For tedious configurations, improve them in #21101 :

VSCode recently gained some support for hiding config as "advanced", maybe we can use that.

Example
---
```rust
fn f() -> i32 {
    if true {
        $0
    }
}
```

**addSemicolonToJumps: true (default)**

```rust
fn f() -> i32 {
    if true {
        return $0;
    }
}
```

**addSemicolonToJumps: false**

```rust
fn f() -> i32 {
    if true {
        return $0
    }
}
```
@ChayimFriedman2
Copy link
Contributor

This is not disabling keyword completion, but removing semicolons from the results

I understand, but this only applies it to some specific keyword. I'm saying that if we should do it, it needs to be no more granular than a decision about all keywords at once.

@A4-Tacks
Copy link
Member Author

I'm saying that if we should do it, it needs to be no more granular than a decision about all keywords at once.

Other keywords are not very sensitive to semicolons

@ChayimFriedman2
Copy link
Contributor

But they do have "smart" completions, e.g. let = .

@A4-Tacks
Copy link
Member Author

But this PR does not conflict with the future "completion.keyword": "smart" | "plain" | "none" config

@A4-Tacks A4-Tacks force-pushed the conf-disable-jump-stmts-semi branch from 1f18e8d to e6cff7a Compare December 17, 2025 13:43
@ChayimFriedman2
Copy link
Contributor

Sure it does not conflict, but I think we don't want so specific config. I suggested that config as an alternative.

@A4-Tacks
Copy link
Member Author

I suggested that config as an alternative.

What is alternative?

@ChayimFriedman2
Copy link
Contributor

To provide a completion.plainKeywords or completion.keywords config.

@A4-Tacks
Copy link
Member Author

Merge both configurations? Or merge one of them?

@ChayimFriedman2
Copy link
Contributor

No, just not have completion.addSemicolonToJumps.

@A4-Tacks
Copy link
Member Author

Should I rename completion.addSemicolonToJumps to completion.plainKeywords?

But how to express the remove semicolon? This is not equivalent to turning it into a non code snippet keyword

@ChayimFriedman2
Copy link
Contributor

What I'm saying is, that I don't want a configuration for not adding semicolon to some keywords. I can, on the other hand, accept a config that will make keyword completion "dumb", not inserting anything beyond the keyword text.

@A4-Tacks
Copy link
Member Author

Is it possible to implement a config: sets any expression keyword snippet as dumb or disabled?

Example

{
    "rust-analyzer.completion.expressionKeywords": {
        "break": "dumb",
        "continue": "disable"
    }
}

@A4-Tacks A4-Tacks marked this pull request as draft December 17, 2025 14:40
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 17, 2025
@ChayimFriedman2
Copy link
Contributor

I feel that that is too too much granularity.

@flodiebold
Copy link
Member

I agree with Chayim, the completion.keyword config variant seems good and going more granular is just going to add to our option proliferation.

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.

Option to disable semicolon insertion

4 participants