Skip to content

"Convert to conditional expression" has excessive leading whitespace when using Tab characters #81115

@jhinder

Description

@jhinder

Version Used: VS 18.0.0 Insiders

Steps to Reproduce:
Invoke "Convert to conditional expression" on the if statement. (Note that the example uses the Tab character for indentation.)

class C
{
	int M()
	{
		if (!ThisMethodNameIsVeryLongForTestingWithManyWords(out var x))
		{
			throw new Exception($"This is a long exception message for repro");
		}

		return x;
	}

	bool ThisMethodNameIsVeryLongForTestingWithManyWords(out int x) { x = 0; return true; }
}

Expected Behavior:
There is only one space character between the ? and : tokens and the respective expression.

Actual Behavior:
There are 12 space characters (3 tab characters at 4 spaces each?) after the ? token, and only 1 after the : token.
This only repros when Tab characters are used; when converted to spaces, it works correctly.

Tabs:
Image

Spaces:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEhelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions