Skip to content

Variable assignment with if else construct should stay in same line #453

Closed
@Aculeo

Description

@Aculeo

I often end up writing something like this, because PowerShell does not have a null coalescing operator (??):

$bar = if ($foo -eq $null) { 'none' } else { $Foo }

However, the code formatter ends up reformatting this (with powershell.codeFormatting.newLineAfterOpenBrace set to false):

 $bar = if ($foo -eq $null) { 'none' 
} else { $foo 
}

IMO this should stay in the same line, could also be an option.

System Details

  • VS Code version: 1.8.1
  • PowerShell extension version: 0.9.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions