rust-lang / rust-lang/rust-analyzer

Rust formatter split some part of keyword to new line instead of continuing the line which can result in errors

Open
#19,885 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 13h
Merged PRs (30d)
69

Description

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P) rust-analyzer version: 0.3.2474-standalone (d2f17873ff 2025-05-23) [/Users/lulu/.vscode/extensions/rust-lang.rust-analyzer-0.3.2474-darwin-arm64/server/rust-analyzer]

rustc version: (eg. output of rustc -V) rustc 1.87.0 (17067e9ac 2025-05-09) (Homebrew)

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable) VSCode 1.100.2

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:

//this is a very long comment text to test the line length and ensure that it wraps correctly in the editor

Actual formatted output:

    //this is
         a very long comment text to 
       test the line leng
       th and ensure that
        it wraps correct
    ly in the editor

Some characters split into multiple lines even they are not full word which can result in errors after forrmatting this code

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 by reproducing the formatting of the long Rust comment shown in the issue with the reported rust-analyzer and rustc versions. Trace the formatter behavior responsible for splitting words and verify the fix by confirming that formatting preserves complete words and produces valid Rust source.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.