Complex Commands API
This document lists a set of complex commands that we consider stable. They are called complex commands because they require parameters and often return a value. You can use the commands in conjunction with the executeCommand
API.
The following is a sample of how to preview a HTML document:
let uri = Uri.parse('file:///some/path/to/file.html');
let success = await commands.executeCommand('vscode.previewHtml', uri);
Commands
vscode.executeWorkspaceSymbolProvider
- Execute all workspace symbol provider.
- query Search string
- (returns) A promise that resolves to an array of SymbolInformation-instances.
vscode.executeDefinitionProvider
- Execute all definition provider.
- uri Uri of a text document
- position Position of a symbol
- (returns) A promise that resolves to an array of Location-instances.
vscode.executeHoverProvider
- Execute all hover provider.
- uri Uri of a text document
- position Position of a symbol
- (returns) A promise that resolves to an array of Hover-instances.
vscode.executeDocumentHighlights
- Execute document highlight provider.
- uri Uri of a text document
- position Position in a text document
- (returns) A promise that resolves to an array of DocumentHighlight-instances.
vscode.executeReferenceProvider
- Execute reference provider.
- uri Uri of a text document
- position Position in a text document
- (returns) A promise that resolves to an array of Location-instances.
vscode.executeDocumentRenameProvider
- Execute rename provider.
- uri Uri of a text document
- position Position in a text document
- newName The new symbol name
- (returns) A promise that resolves to a WorkspaceEdit.
vscode.executeSignatureHelpProvider
- Execute signature help provider.
- uri Uri of a text document
- position 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.executeDocumentSymbolProvider
- Execute document symbol provider.
- uri Uri of a text document
- (returns) A promise that resolves to an array of SymbolInformation-instances.
vscode.executeCompletionItemProvider
- Execute completion item provider.
- uri Uri of a text document
- position Position in a text document
- triggerCharacter (optional) Trigger completion when the user types the character, like
,
or(
- (returns) A promise that resolves to a CompletionList-instance.
vscode.executeCodeActionProvider
- Execute code action provider.
- uri Uri of a text document
- range Range in a text document
- (returns) A promise that resolves to an array of Command-instances.
vscode.executeCodeLensProvider
- Execute completion item provider.
- uri Uri of a text document
- (returns) A promise that resolves to an array of CodeLens-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 Range in a text document
- options Formatting options
- (returns) A promise that resolves to an array of TextEdits.
vscode.executeFormatOnTypeProvider
- Execute document format provider.
- uri Uri of a text document
- position Position in a text document
- ch Character that got typed
- options Formatting options
- (returns) A promise that resolves to an array of TextEdits.
vscode.previewHtml
- Render the html of the resource in an editor view.
Links contained in the document will be handled by VS Code whereby it supports file-resources and virtual resources as well as triggering commands using the 'command'-scheme.
- uri Uri of the resource to preview.
- column (optional) Column in which to preview.
vscode.openFolder
- Open a folder in the current window or new window depending on the newWindow argument.
Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder unless the newWindow parameter is set to true.
- uri (optional) Uri of the folder to open. If not provided, a native dialog will ask the user for the folder.
- newWindow (optional) Whether to open the folder in a new window or the same. Defaults to opening in the same window.
editor.action.showReferences
- Show references at a position in a file
- uri The text document in which to show references
- position The position at which to show
- locations An array of locations.