Skip to content

C/C++ Formatter end suppression (@formatter:on) gets indented #428

Open
@lrademacher

Description

@lrademacher

Describe the bug
In Eclipse CDT on windows (eclipse-cpp-2023-06-R-win32-x86_64) with a C++ project when using the formatter suppression tags (@formatter:off/@formatter:on) and executing the file formatting, the end-tag of the suppression (@formatter:on) gets indented by one level everytime.

To Reproduce
Steps to reproduce the behavior:

  1. Download eclipse-cpp-2023-06-R-win32-x86_64 and start it.
  2. Create a new C/C++ Project (C++ Managed Build)
  3. Add a new file "test.cpp" with the content:
int main() {
	// @formatter:off
	int x[] = {1,2,34,5,5,5,5,5};
	// @formatter:on
}
  1. Go to "Source" -> "Format"
  2. See that // @formatter:on is indented by one level e.g.:
int main() {
	// @formatter:off
	int x[] = {1,2,34,5,5,5,5,5};
		// @formatter:on
}
  1. Repeat at step 4

Expected behavior
When the formatter is executed two times, the file should not change on the second formatting attempt. => No additional indentation on @formatter:on.

Desktop (please complete the following information):

  • OS: Windows 10 Enterprise 64-Bit

Metadata

Metadata

Assignees

No one assigned

    Labels

    editorThe CDT C/C++, Assembly, Makefile and other editors provided by CDTgood-first-issueA good first issue, generally an easy to test bit of code that runs fairly self-contained.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions