Skip to content

Conversation

@aiday-mar
Copy link
Contributor

@aiday-mar aiday-mar commented Mar 21, 2024

The current auto indent implementation is such that when we click on Enter from within [], {}, (), an indentation is added on the next line only if the opening bracket was adjacent to the closing bracket as follows (here | indicates the cursor position):

function f(|)

In some cases, we want to have the next line indented, even if the brackets are not adjancent. Consider the following case:

const array = [1, 2, 3];
array.map(_|)

In this case when Enter is pressed at the cursor position, we would expect the following indentation to happen:

const array = [1, 2, 3];
array.map(_
    |
)

Instead currently we see this:

const array = [1, 2, 3];
array.map(_
|)

This PR aims to address this by introducing extended onEnter rules where we indent whenever the cursor is located after an opening bracket and is followed by whitespace characters and the corresponding closing bracket.

Screen.Recording.2024-03-21.at.17.39.56.mov

@aiday-mar aiday-mar self-assigned this Mar 21, 2024
@aiday-mar aiday-mar requested a review from hediet March 21, 2024 16:51
@aiday-mar aiday-mar marked this pull request as ready for review March 21, 2024 16:51
@aiday-mar aiday-mar removed the request for review from hediet March 21, 2024 16:51
@aiday-mar aiday-mar marked this pull request as draft March 21, 2024 16:51
@aiday-mar aiday-mar marked this pull request as ready for review March 21, 2024 17:01
@aiday-mar aiday-mar requested a review from hediet March 21, 2024 17:01
@aiday-mar aiday-mar enabled auto-merge March 21, 2024 17:01
@vscodenpa vscodenpa added this to the March 2024 milestone Mar 21, 2024
@aiday-mar aiday-mar merged commit b0725d3 into main Mar 22, 2024
@aiday-mar aiday-mar deleted the local-quail branch March 22, 2024 10:07
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants