vscode.window) provides access to VS Code’s UI, including editors, terminals, status bar, notifications, and user input dialogs. It’s one of the most frequently used namespaces in extension development.
Overview
The window namespace enables extensions to:- Show messages and dialogs to users
- Create and manage webview panels
- Access active editors and terminals
- Display progress indicators
- Create custom UI components (quick picks, input boxes)
- Manage output channels and status bar items
Active Editors
Access Active Editor
Editor Properties
activeTextEditor
activeTextEditor
The currently focused text editor or
undefined if none is active.visibleTextEditors
visibleTextEditors
Array of all visible text editors.
activeNotebookEditor
activeNotebookEditor
The currently focused notebook editor or
undefined.activeTerminal
activeTerminal
The currently focused terminal or
undefined.Editor Events
Monitor editor changes with these events:Showing Documents
Open Text Documents
Open at Specific Location
User Messages
Information Messages
Warning and Error Messages
Modal Messages
Quick Pick
Simple Quick Pick
Quick Pick with Custom Items
Advanced Quick Pick
Input Box
Simple Input
Password Input
Custom Input Box
Terminals
Create Terminal
Terminal Events
Access All Terminals
Output Channels
Create Output Channel
Log Output Channel
Status Bar
Create Status Bar Item
Status Bar with Progress
Progress Indicators
Window Progress
Notification Progress
File Dialogs
Open File Dialog
Save File Dialog
Select Folder Dialog
Workspace Folder Picker
Window State
Monitor Window State
Tab Groups
Access Tab Groups
Tab Group Events
Best Practices
Use Appropriate Message Types
Use Appropriate Message Types
Choose the right message type for the situation. Reserve error messages for actual errors, not warnings or info.
Provide Context in Messages
Provide Context in Messages
Include relevant context in messages to help users understand what happened.
Use Progress Indicators for Long Operations
Use Progress Indicators for Long Operations
Show progress for any operation that takes more than a second.
Dispose UI Components
Dispose UI Components
Always dispose of status bar items, output channels, and terminals when they’re no longer needed.
Validate User Input
Validate User Input
Always validate input from showInputBox to ensure data quality.
Related APIs
Text Editor API
Work with text editors and documents
Workspace API
Access workspace files and folders
Commands API
Register and execute commands
Webview API
Create custom UI panels