Skip to content

powershell auto-format indent not tab indenting correctly #1958

Closed
@ebmarquez

Description

@ebmarquez

Issue Type: Bug

Updating a psm1 function the auto format is incorrectly setting the tabs for the second line past the param().

function verb-noun {
    <#
        .SYNOPSIS
        example

        .INPUTS
        String
        System.Management.Automation.PSCredential

        .OUTPUTS
        System.Management.Automation.PSCustomObject

        .NOTES

    #>
    [CmdLetBinding()]
    [OutputType([PSCustomObject])]
    Param(

        # Computer
        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [String]
        $Computer,

        # Credential
        [Parameter(Mandatory = $true)]
        [System.Management.Automation.PSCredential]
        $Credential
    )

    $cmd = Get-ShowCommands | Where-Object { $_.Name -eq 'running-config' }
$result = Invoke-NetDeviceShowCommand -Computer $Computer -Credential $Credential -Command $cmd.CommandLine
Add-Member -InputObject $result -MemberType NoteProperty -Name "Name" -Value $cmd.Name
return $result
}

Settings JSON

{
    "files.autoSave": "afterDelay",
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true,
    "editor.formatOnType": true,
    "files.defaultLanguage": "powershell",
    "files.enableTrash": false,
    "files.trimTrailingWhitespace": true,
    "files.trimFinalNewlines": true,
    "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline",
    "powershell.codeFormatting.useCorrectCasing": true,
    "powershell.debugging.createTemporaryIntegratedConsole": true,
    "git.autofetch": true
}

Logs

5/13/2019 9:56:54 AM [NORMAL] - Visual Studio Code v1.33.1 64-bit
5/13/2019 9:56:54 AM [NORMAL] - PowerShell Extension v1.12.1
5/13/2019 9:56:54 AM [NORMAL] - Operating System: Windows 64-bit
5/13/2019 9:56:54 AM [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path.
5/13/2019 9:56:54 AM [NORMAL] - Language server starting --
5/13/2019 9:56:54 AM [NORMAL] -     exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
5/13/2019 9:56:54 AM [NORMAL] -     args: C:\Users\emarq\.vscode\extensions\ms-vscode.powershell-1.12.1\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.12.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\emarq\.vscode\extensions\ms-vscode.powershell-1.12.1\modules' -EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath 'C:\Users\emarq\.vscode\extensions\ms-vscode.powershell-1.12.1\logs\1557766614-fb346685-a289-43f6-aaec-e284919b3d7a1557766611178\EditorServices.log' -SessionDetailsPath 'C:\Users\emarq\.vscode\extensions\ms-vscode.powershell-1.12.1\sessions\PSES-VSCode-17324-476715' -FeatureFlags @()
5/13/2019 9:56:55 AM [NORMAL] - powershell.exe started, pid: 8816
5/13/2019 9:56:56 AM [NORMAL] - Language server started.
5/13/2019 9:56:56 AM [NORMAL] - {"languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_nwfi4set.gka","debugServiceTransport":"NamedPipe","status":"started","debugServicePipeName":"\\\\.\\pipe\\PSES_zz4eppmk.g3d"}
5/13/2019 9:56:56 AM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_nwfi4set.gka...
5/13/2019 9:56:56 AM [NORMAL] - Language service connected.
5/13/2019 9:57:00 AM [VERBOSE] - Formatting entire document - file:///c%3A/Users/emarq/source/repos/AzureStack/Solution/OnRamp/src/Utils/Azs-PtkNetDevice/DellEmc/ShowCommand/ShowCommand.psm1...
5/13/2019 9:57:04 AM [VERBOSE] - Formatting entire document - file:///c%3A/Users/emarq/source/repos/AzureStack/Solution/OnRamp/src/Utils/Azs-PtkNetDevice/DellEmc/ShowCommand/ShowCommand.psm1...
5/13/2019 9:57:04 AM [VERBOSE] - Formatting entire document - file:///c%3A/Users/emarq/source/repos/AzureStack/Solution/OnRamp/src/Utils/Azs-PtkNetDevice/DellEmc/ShowCommand/ShowCommand.psm1...
5/13/2019 9:57:05 AM [VERBOSE] - Formatting entire document - file:///c%3A/Users/emarq/source/repos/AzureStack/Solution/OnRamp/src/Utils/Azs-PtkNetDevice/DellEmc/ShowCommand/ShowCommand.psm1...
5/13/2019 9:57:05 AM [VERBOSE] - Formatting entire document - file:///c%3A/Users/emarq/source/repos/AzureStack/Solution/OnRamp/src/Utils/Azs-PtkNetDevice/DellEmc/ShowCommand/ShowCommand.psm1...
5/13/2019 9:57:05 AM [VERBOSE] - Document formatting finished in 4.673s
5/13/2019 9:57:08 AM [VERBOSE] - Formatting entire document - file:///c%3A/Users/emarq/source/repos/AzureStack/Solution/OnRamp/src/Utils/Azs-PtkNetDevice/DellEmc/ShowCommand/ShowCommand.psm1...
5/13/2019 9:57:08 AM [VERBOSE] - Document formatting finished in 0.298s
5/13/2019 9:57:09 AM [VERBOSE] - Formatting entire document - file:///c%3A/Users/emarq/source/repos/AzureStack/Solution/OnRamp/src/Utils/Azs-PtkNetDevice/DellEmc/ShowCommand/ShowCommand.psm1...
5/13/2019 9:57:09 AM [VERBOSE] - Document formatting finished in 0.127s
5/13/2019 9:57:09 AM [VERBOSE] - Formatting entire document - file:///c%3A/Users/emarq/source/repos/AzureStack/Solution/OnRamp/src/Utils/Azs-PtkNetDevice/DellEmc/ShowCommand/ShowCommand.psm1...
5/13/2019 9:57:09 AM [VERBOSE] - Document formatting finished in 0.073s
5/13/2019 9:57:09 AM [VERBOSE] - Formatting entire document - file:///c%3A/Users/emarq/source/repos/AzureStack/Solution/OnRamp/src/Utils/Azs-PtkNetDevice/DellEmc/ShowCommand/ShowCommand.psm1...
5/13/2019 9:57:09 AM [VERBOSE] - Document formatting finished in 0.086s
5/13/2019 9:57:09 AM [VERBOSE] - Formatting entire document - file:///c%3A/Users/emarq/source/repos/AzureStack/Solution/OnRamp/src/Utils/Azs-PtkNetDevice/DellEmc/ShowCommand/ShowCommand.psm1...
5/13/2019 9:57:09 AM [VERBOSE] - Document formatting finished in 0.088s

Extension version: 1.12.1
VS Code version: Code 1.33.1 (51b0b28134d51361cf996d2f0a1c698247aeabd8, 2019-04-11T08:27:14.102Z)
OS version: Windows_NT x64 10.0.18362

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz (8 x 2112)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.93GB (7.03GB free)
Process Argv
Screen Reader no
VM 0%

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