将 Visual Studio Code 与 PowerShell 配合使用

已完成

Visual Studio Code (VS Code) 是一种 Microsoft 脚本编辑器,提供了丰富的交互式脚本编辑体验。 此体验与 PowerShell 扩展配合使用时,类似于 PowerShell 集成脚本环境 (ISE)。 VS Code 支持以下 PowerShell 版本:

  • 适用于 Windows、macOS 和 Linux 的 PowerShell 7 及更新版本
  • 适用于 Windows、macOS 和 Linux 的 PowerShell Core 6
  • 仅适用于 Windows 操作系统的 Windows PowerShell 5.1

注意

Visual Studio Code 与 Visual Studio 不同。 可以从 Visual Studio Code 下载 页和 Visual Studio Marketplace 中的 PowerShell 扩展下载 VS Code。 还可以直接从 VS Code 中安装扩展。

Visual Studio Code 中的 ISE 模式

安装 VS Code 和 PowerShell 扩展后,可以通过打开 ISE 模式来复制 ISE 体验

启用 ISE 模式会显著改变 VS Code 的几点工作方式,包括:

  • 在 VS Code 中映射键盘函数,使其与 ISE 中使用的键盘函数相匹配。
  • 允许复制 VS Code 用户界面,使其类似于 ISE。
  • 启用类似于 ISE 的 Tab 自动补全。
  • 提供多个 ISE 主题,使 VS Code 编辑器看起来像 ISE。

其他信息: 有关使用 Visual Studio Code 和复制 ISE 体验的详细信息,请参阅 使用 Visual Studio Code 进行 PowerShell 开发