Skip to content

Incorrect formatting with "C_Cpp.vcFormat.newLine.beforeOpenBrace.block": "newLine" #7926

Description

With the following code:

void f()
{
  while(false){
	}
}

And only "C_Cpp.vcFormat.newLine.beforeOpenBrace.block": "newLine" set (and the other vcFormat settings at defaults), the result of formatting is incorrect:

void f()
{
	while (false)	
{
	}
}

It looks like this was due to multiple internal edits occurring at the same position. VS processes these edits in forward order, whereas we had been processing them in reverse order, on the assumption that this was necessary to avoid impacting the file positions of subsequent edits. Unfortunately, this alters the behavior when multiple internal edits occur at the same position. Fortunately, processing the internal edits in forward order appears to address the issue. (Reversing them was unnecessary).

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions