Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add PowerShell VSCode style settings#5529

Merged
daxian-dbw merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
bergmeister:vscode_ps_settingsbergmeister/PowerShell:vscode_ps_settingsCopy head branch name to clipboard
Nov 28, 2017
Merged

Add PowerShell VSCode style settings#5529
daxian-dbw merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
bergmeister:vscode_ps_settingsbergmeister/PowerShell:vscode_ps_settingsCopy head branch name to clipboard

Conversation

@bergmeister

Copy link
Copy Markdown
Contributor

Add the following VS Code settings to have a more consistent PowerShell style already at the PR stage. It is mainly based on the K&R/OTBS style, which basically means braces are on the same line and that else, catch, and other keywords are "cuddled" (e.g. } else {)
Personally I'd prefer rather the Stroustrup style where there is no "cuddling" but I have seen that the K&R/OTBS is used more often in the codebase.

  // Sets the codeformatting options to follow the given indent style in a way that is compatible with PowerShell syntax. For more information about the brace styles please refer to https://github.com/PoshCode/PowerShellPracticeAndStyle/issues/81.
  "powershell.codeFormatting.preset": "OTBS",
  
  // Adds a space between a keyword and its associated scriptblock expression.
  "powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
  
  // Adds a space between a keyword (if, elseif, while, switch, etc) and its associated conditional expression.
  "powershell.codeFormatting.whitespaceBeforeOpenParen": true,
  
  // Adds spaces before and after an operator ('=', '+', '-', etc.).
  "powershell.codeFormatting.whitespaceAroundOperator": true,
  
  // Adds a space after a separator (',' and ';').
  "powershell.codeFormatting.whitespaceAfterSeparator": true

@rkeithhill

rkeithhill commented Nov 23, 2017

Copy link
Copy Markdown
Collaborator

When I last touched that file I considered adding these settings but I noticed that the PowerShell script in this repo is not terribly consistent style-wise. I like the idea of it being more consistent but this PR would make it easier for folks using VSCode to mix semantic changes with style changes.

I wonder if it would be better to just take the "styling" hit once and make all the script files conform to this style setup?

@bergmeister

bergmeister commented Nov 23, 2017

Copy link
Copy Markdown
Contributor Author

One could apply the styling to the files since VSCode has the Ctrl+K+F shortcut for that. But this is certainly a decision and probably action that the PowerShell team has to make.

@SteveL-MSFT

Copy link
Copy Markdown
Member

I'm fine with the proposed setting changes. We can apply the style universally after GA.

@daxian-dbw daxian-dbw merged commit f5b9942 into PowerShell:master Nov 28, 2017
@TravisEz13 TravisEz13 added this to the 6.0.0-GA milestone Nov 29, 2017
TravisEz13 pushed a commit to TravisEz13/PowerShell that referenced this pull request Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.