rust-lang / rust-lang/rust-analyzer

Option to disable semicolon insertion

Open
#21,292 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

When completing certain keywords, rust-analyzer appends a semicolon which is not visible in the preview text. For example:
Image

With return, it is sensible-enough to account for return type, but I still find it intrusive:

  • this is actually inconsistent behavior
  • it messes with my expectations and muscle memory, since the semicolon is not in the preview text and I am used to typing it manually
  • with break and continue, it doesn't consider context; I may want to specify a label, but the semicolon is inserted even when inside of labeled loops, so I have to delete the semicolon in those cases

https://rust-analyzer.github.io/book/configuration.html#completion.addSemicolonToUnit exists, but from a cursory reading of the source code, this only seems to apply to function call snippets which I also have disabled.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the configuration documentation for completion.addSemicolonToUnit, then trace how semicolons are added to return, break, and continue completions. Done means users can disable these keyword insertions independently, including when labels are valid, with tests covering the affected completion cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.