rust-lang / rust-lang/rustfmt

Support helping editors maintain marks and positions

Open
#3,261 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature-request
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

To continue what I've written up in https://github.com/rust-lang/rust.vim/issues/287 :

Running a reformatter from the context of an editor, raises the expectation that the editor will not lose its cursor position, marks, various highlights, and more.

However, only rustfmt can reliably relate between pre-reformatting and post-reformatting token positions, being that it performs the reformatting. Perhaps a list of token positions can be passed as input to rustfmt, and then their new positions can outputted?

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 reading issue #287 and the discussion in this issue to understand the editor-position requirements. Investigate how rustfmt could receive token positions and report their post-formatting positions; done would mean editors can preserve cursor positions, marks, and highlights across reformatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.