rust-lang / rust-lang/rust-mode
No indentation on function parameters when electric-pair-mode is activated
Nobody has claimed this yet.
- Dominant language
- Emacs Lisp
- Stars
- 1.3k
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
Description
When electric-pair-mode is activated, adding function parameters on a new line results in the new line not being indented (i.e. cursor on column 0).
Example of the bug (‸ denotes the cursor position):
fn test‸
Typing ( will add balanced parentheses and position the cursor between the two:
fn test(‸)
Adding a parameter:
fn test(a: u8,‸)
Then using RET to insert a new line results in:
fn test(a: u8,
‸)
Ideally the final step should indent the line to be aligned on the previous parameter, producing:
fn test(a: u8,
‸)
Note: this doesn't happen when writing C code, even when electric-pair-mode is activated.
For example:
int func(char c,‸)
Adding a new line with RET, indentation is correct:
int func(char c,
‸)
Is there a way to have the indentation when making a new line and still have electric-pair-mode?
Thanks
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the example in rust-mode with electric-pair-mode enabled, then compare the newline behavior with the C example described in the issue. Trace the RET handling and indentation entry points available from rust-mode; done means a parameter line is indented to match the expected alignment while electric-pair-mode remains enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100