Skip to content

Make formatter capitalize cmdlets and parameters #960

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

Closed
Hvid opened this issue Jul 14, 2017 · 4 comments
Closed

Make formatter capitalize cmdlets and parameters #960

Hvid opened this issue Jul 14, 2017 · 4 comments
Labels
Area-Code Formatting Issue-Enhancement A feature request (enhancement).

Comments

@Hvid
Copy link

Hvid commented Jul 14, 2017

Please make it possible to capitalize cmdlets and parameters by pressing tab like ISE.

In ISE, when cursor is placed in the middle of the line "write-host" and you press tab, it becomes "Write-Host". Same goes for parameters - "-erroraction" becomes "-ErrorAction"

Maybe the "Format Document" command could do the same?

@kapilmb kapilmb added Area-Code Formatting Issue-Enhancement A feature request (enhancement). labels Jul 14, 2017
@kapilmb
Copy link

kapilmb commented Jul 14, 2017

Here is a similar issue: PowerShell/PSScriptAnalyzer#767

@DarkLite1
Copy link

+1 on this

@krissmilne
Copy link

As Powershell isn't a case sensitive language, it would be good to provide the case formatting options for the developers preference.

Something along the lines of:

//Changes the case for powershell reserved words (if, else, elseif, function, switch, param etc...) to either UPPER, lower or First (capitalises the first letter)
"powershell.codeFormatting.reservedWordCase": "lower", "upper", "first"

//Changes the case for powershell variables declared in the global or script scope to either UPPER, lower or FirstUpper (PascalCase) or firstLower (camelCase)
"powershell.codeFormatting.globalVariableCase": "lower", "upper", "FirstUpper", "firstLower"

//Changes the case for powershell variables declared in the local or private scope (within functions) to either UPPER, lower or FirstUpper (PascalCase) or firstLower (camelCase)
"powershell.codeFormatting.privateVariableCase": "lower", "upper", "FirstUpper", "firstLower"

//Autocorrects the case for recognised cmdlets and functions
"powershell.codeFormatting.cmdletCase": true, false

//Autocorrects the case for recognised parameters of cmdlets and functions
"powershell.codeFormatting.parameterCase": true, false

@TylerLeonhardt
Copy link
Member

This is actually an issue to be solved in PSScriptAnalyzer. I'm going to close this favor of this:
PowerShell/PSScriptAnalyzer#767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Code Formatting Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

6 participants