Skip to content

Formatting a Java file sometimes eats parts of the code #2173

@Artur-

Description

@Artur-

This is similar to a bug that existed in Eclipse maybe 5 or 10 years ago.

Every now and then when you press format, part of the code is deleted. This is really super bad for any IDE, especially when you have auto format on save turned on. "Done with your changes? Sure, let me just save and commit. Why did you commit broken code, it doesn't even compile? %#€""

It seems like the formatter and also code highlighting gets out of sync with reality when this happens, e.g. in this example you can see that return is incorrectly colored.

formatting-out-of-sync.mov
Environment
  • Operating System: mac os Big Sur
  • JDK version: 17
  • Visual Studio Code version: 1.61.1
  • Java extension version: 0.82.0
Steps To Reproduce
  1. Use VS Code until it happens... there is no reliable way as far as I know

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions