Overview
Thevscode.window namespace provides functions for interacting with the VS Code window, including showing messages, creating UI elements, accessing editors and terminals, and managing user input.
Active Editors
activeTextEditor
The currently active text editor orundefined.
visibleTextEditors
All currently visible text editors.Showing Messages
showInformationMessage
Show an information message to users.showWarningMessage
Show a warning message.showErrorMessage
Show an error message.User Input
showInputBox
Show an input box to ask the user for input.showQuickPick
Show a selection list allowing the user to choose one or more items.Terminal Management
createTerminal
Create a new terminal instance.activeTerminal
The currently active terminal orundefined.
terminals
All opened terminals.Output Channels
createOutputChannel
Create a new output channel for logging.Progress Indication
withProgress
Show progress in the UI while running a task.Status Bar
createStatusBarItem
Create a status bar item.Events
onDidChangeActiveTextEditor
Fires when the active text editor changes.onDidChangeTextEditorSelection
Fires when the selection in an editor changes.Best Practices
Check for Active Editor
Always verify
activeTextEditor is not undefined before using itDispose Resources
Dispose terminals, output channels, and status bar items when no longer needed
Use Appropriate Messages
Use info, warning, or error messages based on the severity
Progress for Long Tasks
Show progress indication for operations that take more than a second