Vscode-powershell: ### snippet to auto generate DOCs for a cmdlet fails.

Created on 17 Aug 2018  路  8Comments  路  Source: PowerShell/vscode-powershell

System Details

  • Operating system name and version:
    Windows 10

  • VS Code version:
    Version: 1.25.1
    Commit: 1dfc5e557209371715f655691b1235b6b26a06be
    Date: 2018-07-11T15:43:11.471Z
    Electron: 1.7.12
    Chrome: 58.0.3029.110
    Node.js: 7.9.0
    V8: 5.8.283.38
    Architecture: ia32

  • PowerShell extension version: 1.8.3
  • Output from $PSVersionTable:
    PS C:\Users\Administrator> $PSVersionTable

Name Value
---- -----
PSVersion 5.0.10586.117
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.117
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

code -v
$pseditor.EditorServicesVersion
code --list-extensions --show-versions
$PSVersionTable

Issue Description

I am experiencing a problem with the ### snippet. This usually places a commented section for my CMDLet with Synopsis description and such. I believe in 1.8.3 there is a new error causing this to Fail. My output now is an odd left aligned version of all my code. I have recreated the problem with a simple Hello World function. The bottom half is what I wrote everything above it is the output of the snippet generator.

function Write-HelloWorld {
[CmdletBinding(DefaultParameterSetName="Default")]
param (
,

)
Write-Host " "
function Write-HelloWorld {
    [CmdletBinding(DefaultParameterSetName="Default")]
    param (
        $Hello,
        $World
    )
    Write-Host "$Hello $World"
}

Attached Logs

Follow the instructions in the README
about capturing and sending logs.

Area-Snippets Issue-Bug

All 8 comments

Hi @Mark-Foresta, would you be able to attach any relevant logs? The instructions are in the README link at the bottom of your issue description

I think I have attached them

It repros for me so that should help in tracking it down.

Problem seems to occur here:
https://github.com/PowerShell/vscode-powershell/blob/6630390c88d29eeca3f463b9292a66db60fb230c/src/features/HelpCompletion.ts#L159-L189

First off it looks like we can't rely on VSCode for indentation as we used to?

Nothing has touched that code in several months though

It looks like we are passing the variable names through correctly, but VSCode is now doing something weird with them???

Ok, I've opened a PR with the fix.

None of that explains VSCode's mysterious behaviour btw, the bug was elsewhere.

Was this page helpful?
0 / 5 - 0 ratings