將 PowerShell 與 Visual Studio Code 搭配使用
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 開發。