Skip to content

[Bug]: Incorrect indentation when object contains string keys #209517

Closed

Description

This is in relation to the nature of the increase indentation rules. If we write:

const a = {a:1

And press Enter, after this the next line will be indented. If we write:

const a = {"a":1

And press Enter, the next line will not be indented.

Screen.Recording.2024-04-04.at.09.21.39.mov

Activity

  1. added
    bug
    editor-autoindent
    on Apr 4, 2024
  2. aiday-mar commented on Apr 4, 2024

    @aiday-mar
    CollaboratorAuthor

    We should ignore the indentation inside of strings. If a string is detected, then apply the indentation rule to everything around the string, but not the string itself.

    We also know when we are inside of a string because we can use the standard token type to determine this.

  3. aiday-mar commented on Apr 4, 2024

    @aiday-mar
    CollaboratorAuthor

    Also related to this case is when we have the following code:

    const a = {"}":1

    We would like to make sure that after the changes made to fix this issue, correct indentation is still applied after pressing Enter in the case above.

  4. removed
    bug
    on Sep 10, 2025
  5. aiday-mar commented on Sep 10, 2025

    @aiday-mar
    CollaboratorAuthor

    Closing this for now, until we revisit the indentation.

  6. locked and limited conversation to collaborators on Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions