Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabExpansion2 should have help #21453

Open
5 tasks done
ThomasNieto opened this issue Apr 9, 2024 · 4 comments
Open
5 tasks done

TabExpansion2 should have help #21453

ThomasNieto opened this issue Apr 9, 2024 · 4 comments
Labels
Needs-Triage The issue is new and needs to be triaged by a work group.

Comments

@ThomasNieto
Copy link
Contributor

Prerequisites

Steps to reproduce

If you run Get-Help TabExpansion2 no help is returned. I am creating this issue here instead of PowerShell-Docs since the command doesn't belong to any module and is defined in code in the following reference.

cc: @sdwheeler

private static readonly string s_tabExpansionFunctionText = @"
<# Options include:
RelativeFilePaths - [bool]
Always resolve file paths using Resolve-Path -Relative.
The default is to use some heuristics to guess if relative or absolute is better.
To customize your own custom options, pass a hashtable to CompleteInput, e.g.
return [System.Management.Automation.CommandCompletion]::CompleteInput($inputScript, $cursorColumn,
@{ RelativeFilePaths=$false }
#>
[CmdletBinding(DefaultParameterSetName = 'ScriptInputSet')]
[OutputType([System.Management.Automation.CommandCompletion])]
Param(
[Parameter(ParameterSetName = 'ScriptInputSet', Mandatory = $true, Position = 0)]
[AllowEmptyString()]
[string] $inputScript,
[Parameter(ParameterSetName = 'ScriptInputSet', Position = 1)]
[int] $cursorColumn = $inputScript.Length,
[Parameter(ParameterSetName = 'AstInputSet', Mandatory = $true, Position = 0)]
[System.Management.Automation.Language.Ast] $ast,
[Parameter(ParameterSetName = 'AstInputSet', Mandatory = $true, Position = 1)]
[System.Management.Automation.Language.Token[]] $tokens,
[Parameter(ParameterSetName = 'AstInputSet', Mandatory = $true, Position = 2)]
[System.Management.Automation.Language.IScriptPosition] $positionOfCursor,
[Parameter(ParameterSetName = 'ScriptInputSet', Position = 2)]
[Parameter(ParameterSetName = 'AstInputSet', Position = 3)]
[Hashtable] $options = $null
)
End
{
if ($psCmdlet.ParameterSetName -eq 'ScriptInputSet')
{
return [System.Management.Automation.CommandCompletion]::CompleteInput(
<#inputScript#> $inputScript,
<#cursorColumn#> $cursorColumn,
<#options#> $options)
}
else
{
return [System.Management.Automation.CommandCompletion]::CompleteInput(
<#ast#> $ast,
<#tokens#> $tokens,
<#positionOfCursor#> $positionOfCursor,
<#options#> $options)
}
}
";

Expected behavior

`Get-Help TabExpansion2` has help

Actual behavior

No help

Error details

No response

Environment data

7.4.1

Visuals

No response

@ThomasNieto ThomasNieto added the Needs-Triage The issue is new and needs to be triaged by a work group. label Apr 9, 2024
@ThomasNieto ThomasNieto changed the title TabExpansion2 should have comment help explaining what it is TabExpansion2 should have help Apr 9, 2024
@sdwheeler
Copy link
Collaborator

sdwheeler commented Apr 10, 2024

It is mentioned here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_built-in_functions?view=powershell-7.4#tabexpansion2

But it doesn't tell you how to use it. I don't know if the PowerShell team ever intended it to be used externally. But I will find out. I still like the idea of a blog post.

Describes the built-in functions in PowerShell.

@ThomasNieto
Copy link
Contributor Author

@sdwheeler This function is similar to Out-Default where it is not intended to be used by the end user but does have help to explain what it is used for in the console.

@SteveL-MSFT
Copy link
Member

TabExpansion2 isn't intended to be used by end-users, but it is used by developers to test tab completion. As such, we should probably have some docs on it, but also probably not promote usage of it.

@ThomasNieto
Copy link
Contributor Author

ThomasNieto commented Apr 22, 2024

@SteveL-MSFT in that case there should be help for it saying its not intended for end users like Out-Default does. There is already docs on the PowerShell help site describing what it is but there is nothing in the console if someone stumbles across the function in that native help system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage The issue is new and needs to be triaged by a work group.
Projects
None yet
Development

No branches or pull requests

3 participants