Skip to content

No indentation on function parameters when electric-pair-mode is activated #287

Open
@zakora

Description

@zakora

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions