Built-in Commands
This document lists a subset of Visual Studio Code commands that you might use with vscode.commands.executeCommand
API.
Read the Commands guide for how to use the commands API.
The following is a sample of how to open a new folder in VS Code:
let uri = Uri.file('/some/path/to/folder');
let success = await commands.executeCommand('vscode.openFolder', uri);
Note: You can review the full set of VS Code commands via the Keyboard Shortcuts editor File > Preferences > Keyboard Shortcuts. The Keyboard Shortcuts editor lists all commands built into VS Code or contributed by extensions, along with their keybindings and visibility when clauses.
Commands
vscode.executeDataToNotebook
- Invoke notebook serializer
- notebookType - A notebook type
- data - Bytes to convert to data
- (returns) - Notebook Data
vscode.executeNotebookToData
- Invoke notebook serializer
- notebookType - A notebook type
- NotebookData - Notebook data to convert to bytes
- (returns) - Bytes
notebook.selectKernel
- Trigger kernel picker for specified notebook editor widget
- options - Select kernel options
- (returns) - no result
interactive.open
- Open interactive window and return notebook editor and input URI
- showOptions - Show Options
- resource - Interactive resource Uri
- controllerId - Notebook controller Id
- title - Interactive editor title
- (returns) - Notebook and input URI
vscode.editorChat.start
- Invoke a new editor chat session
- Run arguments -
- (returns) - no result
vscode.executeDocumentHighlights
- Execute document highlight provider.
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to an array of DocumentHighlight-instances.
vscode.executeDocumentSymbolProvider
- Execute document symbol provider.
- uri - Uri of a text document
- (returns) - A promise that resolves to an array of SymbolInformation and DocumentSymbol instances.
vscode.executeFormatDocumentProvider
- Execute document format provider.
- uri - Uri of a text document
- options - Formatting options
- (returns) - A promise that resolves to an array of TextEdits.
vscode.executeFormatRangeProvider
- Execute range format provider.
- uri - Uri of a text document
- range - A range in a text document
- options - Formatting options
- (returns) - A promise that resolves to an array of TextEdits.
vscode.executeFormatOnTypeProvider
- Execute format on type provider.
- uri - Uri of a text document
- position - A position in a text document
- ch - Trigger character
- options - Formatting options
- (returns) - A promise that resolves to an array of TextEdits.
vscode.executeDefinitionProvider
- Execute all definition providers.
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to an array of Location or LocationLink instances.
vscode.executeTypeDefinitionProvider
- Execute all type definition providers.
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to an array of Location or LocationLink instances.
vscode.executeDeclarationProvider
- Execute all declaration providers.
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to an array of Location or LocationLink instances.
vscode.executeImplementationProvider
- Execute all implementation providers.
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to an array of Location or LocationLink instances.
vscode.executeReferenceProvider
- Execute all reference providers.
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to an array of Location-instances.
vscode.executeHoverProvider
- Execute all hover providers.
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to an array of Hover-instances.
vscode.executeSelectionRangeProvider
- Execute selection range provider.
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to an array of ranges.
vscode.executeWorkspaceSymbolProvider
- Execute all workspace symbol providers.
- query - Search string
- (returns) - A promise that resolves to an array of SymbolInformation-instances.
vscode.prepareCallHierarchy
- Prepare call hierarchy at a position inside a document
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to an array of CallHierarchyItem-instances
vscode.provideIncomingCalls
- Compute incoming calls for an item
- item - A call hierarchy item
- (returns) - A promise that resolves to an array of CallHierarchyIncomingCall-instances
vscode.provideOutgoingCalls
- Compute outgoing calls for an item
- item - A call hierarchy item
- (returns) - A promise that resolves to an array of CallHierarchyOutgoingCall-instances
vscode.prepareRename
- Execute the prepareRename of rename provider.
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to a range and placeholder text.
vscode.executeDocumentRenameProvider
- Execute rename provider.
- uri - Uri of a text document
- position - A position in a text document
- newName - The new symbol name
- (returns) - A promise that resolves to a WorkspaceEdit.
vscode.executeLinkProvider
- Execute document link provider.
- uri - Uri of a text document
- linkResolveCount - (optional) Number of links that should be resolved, only when links are unresolved.
- (returns) - A promise that resolves to an array of DocumentLink-instances.
vscode.provideDocumentSemanticTokensLegend
- Provide semantic tokens legend for a document
- uri - Uri of a text document
- (returns) - A promise that resolves to SemanticTokensLegend.
vscode.provideDocumentSemanticTokens
- Provide semantic tokens for a document
- uri - Uri of a text document
- (returns) - A promise that resolves to SemanticTokens.
vscode.provideDocumentRangeSemanticTokensLegend
- Provide semantic tokens legend for a document range
- uri - Uri of a text document
- range - (optional) A range in a text document
- (returns) - A promise that resolves to SemanticTokensLegend.
vscode.provideDocumentRangeSemanticTokens
- Provide semantic tokens for a document range
- uri - Uri of a text document
- range - A range in a text document
- (returns) - A promise that resolves to SemanticTokens.
vscode.executeCompletionItemProvider
- Execute completion item provider.
- uri - Uri of a text document
- position - A position in a text document
- triggerCharacter - (optional) Trigger completion when the user types the character, like
,
or(
- itemResolveCount - (optional) Number of completions to resolve (too large numbers slow down completions)
- (returns) - A promise that resolves to a CompletionList-instance.
vscode.executeSignatureHelpProvider
- Execute signature help provider.
- uri - Uri of a text document
- position - A position in a text document
- triggerCharacter - (optional) Trigger signature help when the user types the character, like
,
or(
- (returns) - A promise that resolves to SignatureHelp.
vscode.executeCodeLensProvider
- Execute code lens provider.
- uri - Uri of a text document
- itemResolveCount - (optional) Number of lenses that should be resolved and returned. Will only return resolved lenses, will impact performance
- (returns) - A promise that resolves to an array of CodeLens-instances.
vscode.executeCodeActionProvider
- Execute code action provider.
- uri - Uri of a text document
- rangeOrSelection - Range in a text document. Some refactoring provider requires Selection object.
- kind - (optional) Code action kind to return code actions for
- itemResolveCount - (optional) Number of code actions to resolve (too large numbers slow down code actions)
- (returns) - A promise that resolves to an array of Command-instances.
vscode.executeDocumentColorProvider
- Execute document color provider.
- uri - Uri of a text document
- (returns) - A promise that resolves to an array of ColorInformation objects.
vscode.executeColorPresentationProvider
- Execute color presentation provider.
- color - The color to show and insert
- context - Context object with uri and range
- (returns) - A promise that resolves to an array of ColorPresentation objects.
vscode.executeInlayHintProvider
- Execute inlay hints provider
- uri - Uri of a text document
- range - A range in a text document
- (returns) - A promise that resolves to an array of Inlay objects
vscode.executeFoldingRangeProvider
- Execute folding range provider
- uri - Uri of a text document
- (returns) - A promise that resolves to an array of FoldingRange objects
vscode.resolveNotebookContentProviders
- Resolve Notebook Content Providers
- (returns) - A promise that resolves to an array of NotebookContentProvider static info objects.
vscode.executeInlineValueProvider
- Execute inline value provider
- uri - Uri of a text document
- range - A range in a text document
- context - An InlineValueContext
- (returns) - A promise that resolves to an array of InlineValue objects
vscode.open
- Opens the provided resource in the editor.
- Uri -
vscode.openWith
- Opens the provided resource with a specific editor.
- resource - Resource to open
- viewId - Custom editor view id or 'default' to use VS Code's default editor
- columnOrOptions - (optional) Either the column in which to open or editor options, see vscode.TextDocumentShowOptions
- (returns) - no result
vscode.diff
- Opens the provided resources in the diff editor to compare their contents.
- left - Left-hand side resource of the diff editor
- right - Right-hand side resource of the diff editor
- title - Human readable title for the diff editor
- options - (optional) Either the column in which to open, or editor options (see vscode.TextDocumentShowOptions)
vscode.changes
- Opens a list of resources in the changes editor to compare their contents.
- title - Human readable title for the changes editor
- resourceList - List of resources to compare
vscode.prepareTypeHierarchy
- Prepare type hierarchy at a position inside a document
- uri - Uri of a text document
- position - A position in a text document
- (returns) - A promise that resolves to an array of TypeHierarchyItem-instances
vscode.provideSupertypes
- Compute supertypes for an item
- item - A type hierarchy item
- (returns) - A promise that resolves to an array of TypeHierarchyItem-instances
vscode.provideSubtypes
- Compute subtypes for an item
- item - A type hierarchy item
- (returns) - A promise that resolves to an array of TypeHierarchyItem-instances
vscode.revealTestInExplorer
- Reveals a test instance in the explorer
- testItem - A VS Code TestItem.
- (returns) - no result
setContext
- Set a custom context key value that can be used in when clauses.
- name - The context key name
- value - The context key value
- (returns) - no result
vscode.executeMappedEditsProvider
- Execute Mapped Edits Provider
- uri - Uri of a text document
- string_array - Array of string,
- MappedEditsContext - Mapped Edits Context
- (returns) - A promise that resolves to a workspace edit or null
cursorMove
- Move cursor to a logical position in the view
- Cursor move argument object - Property-value pairs that can be passed through this argument:
- 'to': A mandatory logical position value providing where to move the cursor.
'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',
'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'
'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'
'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside' - 'by': Unit to move. Default is computed based on 'to' value.
'line', 'wrappedLine', 'character', 'halfLine'
- 'to': A mandatory logical position value providing where to move the cursor.