Skip to content

UseCorrectCasing removes <module>\ from <module>\<cmdlet> in vscode-powershell #2023

Open
@o-l-a-v

Description

@o-l-a-v

Steps to reproduce

This does not happen if you have a file only containing:

Az.Monitor\Get-AzDataCollectionRuleAssociation

Thus:

  1. VSCode settings.json contains: "powershell.codeFormatting.useCorrectCasing": true.

  2. Create temp.ps1 with following content:

    Write-Information -MessageData 'Adding associations.'
    $DCRs | ForEach-Object -ThrottleLimit $DCRs.'Count' -Parallel {
        $null = Add-Member -InputObject $_ -MemberType 'NoteProperty' -Force -Name 'associations' -Value (
            [array](
                Az.Monitor\Get-AzDataCollectionRuleAssociation -SubscriptionId $_.'subscriptionId' `
                    -ResourceGroupName $_.'resourceGroup' -DataCollectionRuleName $_.'name'
            )
        )
    } 6>$null
  3. Save. The content becomes:

    Write-Information -MessageData 'Adding associations.'
    $DCRs | ForEach-Object -ThrottleLimit $DCRs.'Count' -Parallel {
        $null = Add-Member -InputObject $_ -MemberType 'NoteProperty' -Force -Name 'associations' -Value (
            [array](
                Get-AzDataCollectionRuleAssociation -SubscriptionId $_.'subscriptionId' `
                    -ResourceGroupName $_.'resourceGroup' -DataCollectionRuleName $_.'name'
            )
        )
    } 6>$null

Expected behavior

Content should not change.

Actual behavior

Az.Monitor\ gets stripped.

Environment data

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions