Provides PowerShell language and debugging support for Visual Studio Code
glennsarti and tylerl0706 (GH-1523) Remove duplicate/overlapping folding regions (#1525)
Previously the syntax folder returned an ordered list of folding ranges which
VS Code would "ignore" overlapping or duplicate ranges.  However on manual
testing, it showed that duplicate region did exist and could be folded/unfolded
using the "Fold All" and "Unfold All" commands, but could NOT be manipulated
manually in the editor using the +/- indicator.

This commit uses a filter which removes any duplicate or overlapping regions
which is easily detected via similar region start lines.  This commit also adds
a test for this scenario.
Latest commit 67724b7 Sep 17, 2018
Permalink
Failed to load latest commit information.
.github GitHub issue template tweaks and add PSSA template (#1321) May 14, 2018
.vscode Fix markdown syntax (#1382) Jun 27, 2018
build Update Travis to PowerShell Core 6.0.2 (#1373) Jun 19, 2018
docs Update community_snippets.md (#1435) Jul 17, 2018
examples Updates to Examples PSSA settings file to include more rule config (#… May 7, 2018
images Update PowerShell icon Nov 10, 2015
modules Consume Editor Services host as PowerShell module Jun 12, 2016
scripts Add BitsTransfer & user switch to install latest user profile insider… Aug 23, 2018
snippets Fix markdown syntax (#1382) Jun 27, 2018
src (GH-1523) Remove duplicate/overlapping folding regions (#1525) Sep 17, 2018
test (GH-1523) Remove duplicate/overlapping folding regions (#1525) Sep 17, 2018
themes/theme-psise Update PSISE Theme Jun 12, 2017
tools pulls -> pull (#1508) Sep 5, 2018
.gitattributes Add package-lock.json file Oct 26, 2017
.gitignore ignore mac finder files Oct 16, 2017
.travis.yml Update Travis to PowerShell Core 6.0.2 (#1373) Jun 19, 2018
.vscodeignore Add extension unit testing infrastructure Sep 6, 2017
CHANGELOG.md pulls -> pull Aug 31, 2018
CODE_OF_CONDUCT.md Actually add CODE_OF_CONDUCT.md Jan 3, 2018
LICENSE.txt Update LICENSE.txt Feb 8, 2016
README.md Update README.md with kbds and what to do if you find a vulnerability ( Jun 20, 2018
Third Party Notices.txt Update Third Party Notices.txt Feb 8, 2016
appveyor.yml [Ignore] Increment version to 1.8.5 (#1512) Sep 4, 2018
build.ps1 add build.ps1 to align with PSES and other PowerShell projects (#1199) Mar 1, 2018
package-lock.json update deps (#1487) Aug 16, 2018
package.json [Ignore] Increment version to 1.8.5 (#1512) Sep 4, 2018
tsconfig.json Update TypeScript to 2.0.3 Nov 18, 2016
tslint.json Add tslint rule file-header to enforce copyright in TS files (#1396) Jul 2, 2018
vscode-powershell.build.ps1 Prepare changelog and infrastructure for 1.8.0 release Jul 11, 2018

README.md

PowerShell Language Support for Visual Studio Code

Version Installs windows build linux/macos build Join the chat at https://gitter.im/PowerShell/vscode-powershell

This extension provides rich PowerShell language support for Visual Studio Code. Now you can write and debug PowerShell scripts using the excellent IDE-like interface that Visual Studio Code provides.

Platform support

  • Windows 7 through 10 with PowerShell v3 and higher
  • Linux with PowerShell v6 (all PowerShell-supported distributions)
  • macOS and OS X with PowerShell v6

Read the installation instructions to get more details on how to use the extension on these platforms.

Read the FAQ for answers to common questions.

Features

  • Syntax highlighting
  • Code snippets
  • IntelliSense for cmdlets and more
  • Rule-based analysis provided by PowerShell Script Analyzer
  • Go to Definition of cmdlets and variables
  • Find References of cmdlets and variables
  • Document and workspace symbol discovery
  • Run selected selection of PowerShell code using F8
  • Launch online help for the symbol under the cursor using Ctrl+F1
  • Local script debugging and basic interactive console support!

Quick Installation

If you're on Windows 7 or greater with the PowerShellGet module installed, you can easily install both Visual Studio Code and the PowerShell extension by running the following command:

Install-Script Install-VSCode -Scope CurrentUser; Install-VSCode.ps1

You will need to accept the prompts that appear if this is your first time running the Install-Script command.

Alternatively you can download and execute the script directly from the web without the use of Install-Script. However we highly recommend that you read the script first before running it in this way!

iex (iwr https://git.io/vbxjj)

Installing the Extension

You can install the official release of the PowerShell extension by following the steps in the Visual Studio Code documentation. In the Extensions pane, search for "PowerShell" extension and install it there. You will get notified automatically about any future extension updates!

You can also install a VSIX package from our Releases page by following the Install from a VSIX instructions. The easiest way is through the command line:

code --install-extension PowerShell-<version>.vsix

NOTE: If you are using VS Code Insiders, the command will be code-insiders.

Example Scripts

There are some example scripts in the extension's examples folder that you can use to discover PowerShell editing and debugging functionality. Please check out the included README.md file to learn more about how to use them.

This folder can be found at the following path:

C:\Users\<yourusername>\.vscode\extensions\ms-vscode.PowerShell-<version>\examples

To open/view the extension's examples in Visual Studio Code, run the following from your PowerShell command prompt:

code (Get-ChildItem $Home\.vscode\extensions\ms-vscode.PowerShell-*\examples)[-1]

Reporting Problems

If you're having trouble with the PowerShell extension, please follow these instructions to file an issue on our GitHub repository:

1. File an issue on our Issues Page

Make sure to fill in the information that is requested in the issue template as it will help us investigate the problem more quickly.

To automatically create a bug report from within the extension, open the Command pallet (Ctrl/Cmd+Shift+P) and run the "Report a problem on GitHub" command. Some basic information about your instance and powershell versions will be collected and inserted into a new GitHub issue.

NOTE: If you believe that there is a security vulnerability in the PowerShell extension for VSCode, it must be reported to secure@microsoft.com to allow for Coordinated Vulnerability Disclosure. Only file an issue, if secure@microsoft.com has confirmed filing an issue is appropriate.

2. Capture verbose logs and send them to us

If you're having an issue with crashing or other erratic behavior, add the following line to your User Settings in Visual Studio Code:

    "powershell.developer.editorServicesLogLevel": "Verbose"

Restart Visual Studio Code and try to reproduce the problem. Once you are done with that, zip up the logs in the corresponding folder for your operating system:

  • Windows: $HOME\.vscode\extensions\ms-vscode.PowerShell-<CURRENT VERSION>\logs
  • Linux and macOS: ~/.vscode/extensions/ms-vscode.PowerShell-<CURRENT VERSION>/logs

Alternatively, you can open the log folder using the Command pallet (Ctrl/Cmd+Shift+P) and running the "Open powerShell Extension Logs Folder" command.

You have two options for sending us the logs:

  1. If you are editing scripts that contain sensitive information (intellectual property, deployment or administrative information, etc), e-mail the logs directly to vscode-powershell@microsoft.com.

  2. If you are editing scripts that don't contain sensitive information, you can drag and drop your logs ZIP file into the GitHub issue that you are creating.

Contributing to the Code

Check out the development documentation for more details on how to contribute to this extension!

Maintainers

License

This extension is licensed under the MIT License. Please see the third-party notices file for details on the third-party binaries that we include with releases of this project.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.