Skip to content

Possible formatting issue related to unary operators #948

Closed
@AWahlqvist

Description

@AWahlqvist

Issue Description

So I opened this bug at the VSCode repo:
PowerShell/vscode-powershell#1237

It's about unary operators that (from what I can tell), aren't handled correctly when formatting the code.

This:

$numberOfDaysToSubtract = 10
(Get-Date).AddDays(-$numberOfDaysToSubtract)

Becomes this:

$numberOfDaysToSubtract = 10
(Get-Date).AddDays( - $numberOfDaysToSubtract)

When formatting the code in VSCode with powershell.codeFormatting.whitespaceAroundOperator set to true.

I got a response from @tylerl0706 who clarified that this formatting actually comes from PSSA, which is why I created a bug here instead.

What do you think?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions