Skip to content

🐛 Biome corrupts formatting with formatOnType enabled and attempting to close parens or brackets #912

@mkahvi

Description

@mkahvi

VS Code version

1.108.0

Extension version

3.3.0

Biome version

2.3.10

Operating system

  • Windows
  • macOS
  • Linux

Description

Biome mildly corrupts formatting with formatOnType enabled when closing parens or brackets by adding extra padding before the opening paren/bracket and sometimes removes newlines.

For example

console.log(

Becomes

console.log      ()

or

  {
    { // <- closing this
  }

Becomes

    {      {
      }
    }

(), [] and {} all suffer from this. Happens in JS and JSON.

In some circumstances this doesn't happen, for example the above console.log() example doesn't happen if you type it inside unclosed curly brackets.

As a side note there doesn't seem to be a way to disable format-on-type specifically for Biome and I'd rather not disable that for everything that isn't formatted by biome also.

Steps to reproduce

  1. Ensure editor.formatOnType is enabled
  2. Close any paren or bracket in code

Expected behavior

Bracket is closed, not much else.

Does this issue occur when using the CLI directly?

Not sure / Not applicable

Link to a minimal reproduction

No response

Logs


Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug confirmedReport has been confirmed as a valid bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions