rust-lang / rust-lang/rust-analyzer

VSCode Cursor Auto Indent

Open
#13,612 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The one feature that is missing is cursor auto-indentation. It is configured via "editor.autoIndent" setting that is set to "full" by default.

For example, cursor | is placed here:

App::new()|
    .insert_resource(...);

After pressing Enter inside incomplete statement, cursor is placed here:

App::new()
|
    .insert_resource(...);

But I expected it here:

App::new()
    |
    .insert_resource(...);

From the API documentation:

full: The editor will keep the current line's indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages.

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 locating rust-analyzer's VSCode/LSP integration for the editor.autoIndent setting and tracing how Enter handling and indentation are exposed. Compare the current behavior with VSCode's documented "full" mode using the Rust example in the issue; done means Enter places the cursor at the continuation indentation for incomplete statements.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.