Built-in Commands | Visual Studio Code Extension API
AI agents: See llms.txt for documentation discovery and navigation. Documentation articles are also available as Markdown by appending .md to the article URL. Join VS Code at Microsoft Ignite or catch the sessions online. A year of VS Code, wrapped. Explore the highlights. Built-in Commands View as Markdown Ask in VS Code Ask in VS Code Insiders 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 acti
The rest of this page is on the live site.