@types/vscode
- Version 1.92.0
- Published
- 661 kB
- No dependencies
- MIT license
Install
npm i @types/vscode
yarn add @types/vscode
pnpm add @types/vscode
Overview
TypeScript definitions for vscode
Index
Namespaces
vscode
- AccessibilityInformation
- AuthenticationForceNewSessionOptions
- AuthenticationGetSessionOptions
- AuthenticationProvider
- AuthenticationProviderAuthenticationSessionsChangeEvent
- AuthenticationProviderInformation
- AuthenticationProviderOptions
- AuthenticationSession
- AuthenticationSessionAccountInformation
- AuthenticationSessionsChangeEvent
- AutoClosingPair
- BranchCoverage
- Breakpoint
- BreakpointsChangeEvent
- CallHierarchyIncomingCall
- CallHierarchyItem
- CallHierarchyOutgoingCall
- CallHierarchyProvider
- CancellationError
- CancellationToken
- CancellationTokenSource
- CharacterPair
- ChatContext
- ChatErrorDetails
- ChatFollowup
- ChatFollowupProvider
- ChatParticipant
- ChatPromptReference
- ChatRequest
- ChatRequestHandler
- ChatRequestTurn
- ChatResponseAnchorPart
- ChatResponseCommandButtonPart
- ChatResponseFileTree
- ChatResponseFileTreePart
- ChatResponseMarkdownPart
- ChatResponsePart
- ChatResponseProgressPart
- ChatResponseReferencePart
- ChatResponseStream
- ChatResponseTurn
- ChatResult
- ChatResultFeedback
- ChatResultFeedbackKind
- Clipboard
- CodeAction
- CodeActionContext
- CodeActionKind
- CodeActionProvider
- CodeActionProviderMetadata
- CodeActionTriggerKind
- CodeLens
- CodeLensProvider
- Color
- ColorInformation
- ColorPresentation
- ColorTheme
- ColorThemeKind
- Command
- Comment
- CommentAuthorInformation
- CommentController
- CommentingRangeProvider
- CommentMode
- CommentOptions
- CommentReaction
- CommentReply
- CommentRule
- CommentThread
- CommentThreadCollapsibleState
- CommentThreadState
- CompletionContext
- CompletionItem
- CompletionItemKind
- CompletionItemLabel
- CompletionItemProvider
- CompletionItemTag
- CompletionList
- CompletionTriggerKind
- ConfigurationChangeEvent
- ConfigurationScope
- ConfigurationTarget
- CustomDocument
- CustomDocumentBackup
- CustomDocumentBackupContext
- CustomDocumentContentChangeEvent
- CustomDocumentEditEvent
- CustomDocumentOpenContext
- CustomEditorProvider
- CustomExecution
- CustomReadonlyEditorProvider
- CustomTextEditorProvider
- DataTransfer
- DataTransferFile
- DataTransferItem
- DebugAdapter
- DebugAdapterDescriptor
- DebugAdapterDescriptorFactory
- DebugAdapterExecutable
- DebugAdapterExecutableOptions
- DebugAdapterInlineImplementation
- DebugAdapterNamedPipeServer
- DebugAdapterServer
- DebugAdapterTracker
- DebugAdapterTrackerFactory
- DebugConfiguration
- DebugConfigurationProvider
- DebugConfigurationProviderTriggerKind
- DebugConsole
- DebugConsoleMode
- DebugProtocolBreakpoint
- DebugProtocolMessage
- DebugProtocolSource
- DebugSession
- DebugSessionCustomEvent
- DebugSessionOptions
- DebugStackFrame
- DebugThread
- Declaration
- DeclarationCoverage
- DeclarationProvider
- DecorationInstanceRenderOptions
- DecorationOptions
- DecorationRangeBehavior
- DecorationRenderOptions
- Definition
- DefinitionLink
- DefinitionProvider
- Diagnostic
- DiagnosticChangeEvent
- DiagnosticCollection
- DiagnosticRelatedInformation
- DiagnosticSeverity
- DiagnosticTag
- Disposable
- DocumentColorProvider
- DocumentDropEdit
- DocumentDropEditProvider
- DocumentFilter
- DocumentFormattingEditProvider
- DocumentHighlight
- DocumentHighlightKind
- DocumentHighlightProvider
- DocumentLink
- DocumentLinkProvider
- DocumentRangeFormattingEditProvider
- DocumentRangeSemanticTokensProvider
- DocumentSelector
- DocumentSemanticTokensProvider
- DocumentSymbol
- DocumentSymbolProvider
- DocumentSymbolProviderMetadata
- EndOfLine
- EnterAction
- EnvironmentVariableCollection
- EnvironmentVariableMutator
- EnvironmentVariableMutatorOptions
- EnvironmentVariableMutatorType
- EnvironmentVariableScope
- EvaluatableExpression
- EvaluatableExpressionProvider
- Event
- EventEmitter
- Extension
- ExtensionContext
- ExtensionKind
- ExtensionMode
- ExtensionTerminalOptions
- FileChangeEvent
- FileChangeType
- FileCoverage
- FileCoverageDetail
- FileCreateEvent
- FileDecoration
- FileDecorationProvider
- FileDeleteEvent
- FilePermission
- FileRenameEvent
- FileStat
- FileSystem
- FileSystemError
- FileSystemProvider
- FileSystemWatcher
- FileType
- FileWillCreateEvent
- FileWillDeleteEvent
- FileWillRenameEvent
- FoldingContext
- FoldingRange
- FoldingRangeKind
- FoldingRangeProvider
- FormattingOptions
- FunctionBreakpoint
- GlobalEnvironmentVariableCollection
- GlobPattern
- Hover
- HoverProvider
- ImplementationProvider
- IndentAction
- IndentationRule
- InlayHint
- InlayHintKind
- InlayHintLabelPart
- InlayHintsProvider
- InlineCompletionContext
- InlineCompletionItem
- InlineCompletionItemProvider
- InlineCompletionList
- InlineCompletionTriggerKind
- InlineValue
- InlineValueContext
- InlineValueEvaluatableExpression
- InlineValuesProvider
- InlineValueText
- InlineValueVariableLookup
- InputBox
- InputBoxOptions
- InputBoxValidationMessage
- InputBoxValidationSeverity
- LanguageConfiguration
- LanguageModelAccessInformation
- LanguageModelChat
- LanguageModelChatMessage
- LanguageModelChatMessageRole
- LanguageModelChatRequestOptions
- LanguageModelChatResponse
- LanguageModelChatSelector
- LanguageModelError
- LanguageStatusItem
- LanguageStatusSeverity
- LinkedEditingRangeProvider
- LinkedEditingRanges
- Location
- LocationLink
- LogLevel
- LogOutputChannel
- MarkdownString
- MarkedString
- Memento
- MessageItem
- MessageOptions
- NotebookCell
- NotebookCellData
- NotebookCellExecution
- NotebookCellExecutionSummary
- NotebookCellKind
- NotebookCellOutput
- NotebookCellOutputItem
- NotebookCellStatusBarAlignment
- NotebookCellStatusBarItem
- NotebookCellStatusBarItemProvider
- NotebookController
- NotebookControllerAffinity
- NotebookData
- NotebookDocument
- NotebookDocumentCellChange
- NotebookDocumentChangeEvent
- NotebookDocumentContentChange
- NotebookDocumentContentOptions
- NotebookDocumentShowOptions
- NotebookDocumentWillSaveEvent
- NotebookEdit
- NotebookEditor
- NotebookEditorRevealType
- NotebookEditorSelectionChangeEvent
- NotebookEditorVisibleRangesChangeEvent
- NotebookRange
- NotebookRendererMessaging
- NotebookSerializer
- OnEnterRule
- OnTypeFormattingEditProvider
- OpenDialogOptions
- OutputChannel
- OverviewRulerLane
- ParameterInformation
- Position
- ProcessExecution
- ProcessExecutionOptions
- Progress
- ProgressLocation
- ProgressOptions
- ProviderResult
- Pseudoterminal
- QuickDiffProvider
- QuickInput
- QuickInputButton
- QuickInputButtons
- QuickPick
- QuickPickItem
- QuickPickItemButtonEvent
- QuickPickItemKind
- QuickPickOptions
- Range
- ReferenceContext
- ReferenceProvider
- RelativePattern
- RenameProvider
- RunOptions
- SaveDialogOptions
- SecretStorage
- SecretStorageChangeEvent
- SelectedCompletionInfo
- Selection
- SelectionRange
- SelectionRangeProvider
- SemanticTokens
- SemanticTokensBuilder
- SemanticTokensEdit
- SemanticTokensEdits
- SemanticTokensLegend
- ShellExecution
- ShellExecutionOptions
- ShellQuotedString
- ShellQuoting
- ShellQuotingOptions
- SignatureHelp
- SignatureHelpContext
- SignatureHelpProvider
- SignatureHelpProviderMetadata
- SignatureHelpTriggerKind
- SignatureInformation
- SnippetString
- SnippetTextEdit
- SourceBreakpoint
- SourceControl
- SourceControlInputBox
- SourceControlResourceDecorations
- SourceControlResourceGroup
- SourceControlResourceState
- SourceControlResourceThemableDecorations
- StatementCoverage
- StatusBarAlignment
- StatusBarItem
- SymbolInformation
- SymbolKind
- SymbolTag
- SyntaxTokenType
- Tab
- TabChangeEvent
- TabGroup
- TabGroupChangeEvent
- TabGroups
- TabInputCustom
- TabInputNotebook
- TabInputNotebookDiff
- TabInputTerminal
- TabInputText
- TabInputTextDiff
- TabInputWebview
- Task
- TaskDefinition
- TaskEndEvent
- TaskExecution
- TaskFilter
- TaskGroup
- TaskPanelKind
- TaskPresentationOptions
- TaskProcessEndEvent
- TaskProcessStartEvent
- TaskProvider
- TaskRevealKind
- TaskScope
- TaskStartEvent
- TelemetryLogger
- TelemetryLoggerOptions
- TelemetrySender
- TelemetryTrustedValue
- Terminal
- TerminalDimensions
- TerminalEditorLocationOptions
- TerminalExitReason
- TerminalExitStatus
- TerminalLink
- TerminalLinkContext
- TerminalLinkProvider
- TerminalLocation
- TerminalOptions
- TerminalProfile
- TerminalProfileProvider
- TerminalSplitLocationOptions
- TerminalState
- TestController
- TestCoverageCount
- TestItem
- TestItemCollection
- TestMessage
- TestRun
- TestRunProfile
- TestRunProfileKind
- TestRunRequest
- TestTag
- TextDocument
- TextDocumentChangeEvent
- TextDocumentChangeReason
- TextDocumentContentChangeEvent
- TextDocumentContentProvider
- TextDocumentSaveReason
- TextDocumentShowOptions
- TextDocumentWillSaveEvent
- TextEdit
- TextEditor
- TextEditorCursorStyle
- TextEditorDecorationType
- TextEditorEdit
- TextEditorLineNumbersStyle
- TextEditorOptions
- TextEditorOptionsChangeEvent
- TextEditorRevealType
- TextEditorSelectionChangeEvent
- TextEditorSelectionChangeKind
- TextEditorViewColumnChangeEvent
- TextEditorVisibleRangesChangeEvent
- TextLine
- ThemableDecorationAttachmentRenderOptions
- ThemableDecorationInstanceRenderOptions
- ThemableDecorationRenderOptions
- ThemeColor
- ThemeIcon
- TreeCheckboxChangeEvent
- TreeDataProvider
- TreeDragAndDropController
- TreeItem
- TreeItemCheckboxState
- TreeItemCollapsibleState
- TreeItemLabel
- TreeView
- TreeViewExpansionEvent
- TreeViewOptions
- TreeViewSelectionChangeEvent
- TreeViewVisibilityChangeEvent
- TypeDefinitionProvider
- TypeHierarchyItem
- TypeHierarchyProvider
- UIKind
- Uri
- UriHandler
- version
- ViewBadge
- ViewColumn
- Webview
- WebviewOptions
- WebviewPanel
- WebviewPanelOnDidChangeViewStateEvent
- WebviewPanelOptions
- WebviewPanelSerializer
- WebviewPortMapping
- WebviewView
- WebviewViewProvider
- WebviewViewResolveContext
- WindowState
- WorkspaceConfiguration
- WorkspaceEdit
- WorkspaceEditEntryMetadata
- WorkspaceEditMetadata
- WorkspaceFolder
- WorkspaceFolderPickOptions
- WorkspaceFoldersChangeEvent
- WorkspaceSymbolProvider
vscode.debug
- activeDebugConsole
- activeDebugSession
- activeStackItem
- addBreakpoints()
- asDebugSourceUri()
- breakpoints
- onDidChangeActiveDebugSession
- onDidChangeActiveStackItem
- onDidChangeBreakpoints
- onDidReceiveDebugSessionCustomEvent
- onDidStartDebugSession
- onDidTerminateDebugSession
- registerDebugAdapterDescriptorFactory()
- registerDebugAdapterTrackerFactory()
- registerDebugConfigurationProvider()
- removeBreakpoints()
- startDebugging()
- stopDebugging()
vscode.languages
- createDiagnosticCollection()
- createLanguageStatusItem()
- getDiagnostics()
- getLanguages()
- match()
- onDidChangeDiagnostics
- registerCallHierarchyProvider()
- registerCodeActionsProvider()
- registerCodeLensProvider()
- registerColorProvider()
- registerCompletionItemProvider()
- registerDeclarationProvider()
- registerDefinitionProvider()
- registerDocumentDropEditProvider()
- registerDocumentFormattingEditProvider()
- registerDocumentHighlightProvider()
- registerDocumentLinkProvider()
- registerDocumentRangeFormattingEditProvider()
- registerDocumentRangeSemanticTokensProvider()
- registerDocumentSemanticTokensProvider()
- registerDocumentSymbolProvider()
- registerEvaluatableExpressionProvider()
- registerFoldingRangeProvider()
- registerHoverProvider()
- registerImplementationProvider()
- registerInlayHintsProvider()
- registerInlineCompletionItemProvider()
- registerInlineValuesProvider()
- registerLinkedEditingRangeProvider()
- registerOnTypeFormattingEditProvider()
- registerReferenceProvider()
- registerRenameProvider()
- registerSelectionRangeProvider()
- registerSignatureHelpProvider()
- registerTypeDefinitionProvider()
- registerTypeHierarchyProvider()
- registerWorkspaceSymbolProvider()
- setLanguageConfiguration()
- setTextDocumentLanguage()
vscode.window
- activeColorTheme
- activeNotebookEditor
- activeTerminal
- activeTextEditor
- createInputBox()
- createOutputChannel()
- createQuickPick()
- createStatusBarItem()
- createTerminal()
- createTextEditorDecorationType()
- createTreeView()
- createWebviewPanel()
- onDidChangeActiveColorTheme
- onDidChangeActiveNotebookEditor
- onDidChangeActiveTerminal
- onDidChangeActiveTextEditor
- onDidChangeNotebookEditorSelection
- onDidChangeNotebookEditorVisibleRanges
- onDidChangeTerminalState
- onDidChangeTextEditorOptions
- onDidChangeTextEditorSelection
- onDidChangeTextEditorViewColumn
- onDidChangeTextEditorVisibleRanges
- onDidChangeVisibleNotebookEditors
- onDidChangeVisibleTextEditors
- onDidChangeWindowState
- onDidCloseTerminal
- onDidOpenTerminal
- registerCustomEditorProvider()
- registerFileDecorationProvider()
- registerTerminalLinkProvider()
- registerTerminalProfileProvider()
- registerTreeDataProvider()
- registerUriHandler()
- registerWebviewPanelSerializer()
- registerWebviewViewProvider()
- setStatusBarMessage()
- showErrorMessage()
- showInformationMessage()
- showInputBox()
- showNotebookDocument()
- showOpenDialog()
- showQuickPick()
- showSaveDialog()
- showTextDocument()
- showWarningMessage()
- showWorkspaceFolderPick()
- state
- tabGroups
- terminals
- visibleNotebookEditors
- visibleTextEditors
- withProgress()
- withScmProgress()
vscode.workspace
- applyEdit()
- asRelativePath()
- createFileSystemWatcher()
- findFiles()
- fs
- getConfiguration()
- getWorkspaceFolder()
- isTrusted
- name
- notebookDocuments
- onDidChangeConfiguration
- onDidChangeNotebookDocument
- onDidChangeTextDocument
- onDidChangeWorkspaceFolders
- onDidCloseNotebookDocument
- onDidCloseTextDocument
- onDidCreateFiles
- onDidDeleteFiles
- onDidGrantWorkspaceTrust
- onDidOpenNotebookDocument
- onDidOpenTextDocument
- onDidRenameFiles
- onDidSaveNotebookDocument
- onDidSaveTextDocument
- onWillCreateFiles
- onWillDeleteFiles
- onWillRenameFiles
- onWillSaveNotebookDocument
- onWillSaveTextDocument
- openNotebookDocument()
- openTextDocument()
- registerFileSystemProvider()
- registerNotebookSerializer()
- registerTaskProvider()
- registerTextDocumentContentProvider()
- rootPath
- save()
- saveAll()
- saveAs()
- textDocuments
- updateWorkspaceFolders()
- workspaceFile
- workspaceFolders
Namespaces
namespace vscode
module 'vscode' {}
Type Definition for Visual Studio Code 1.92 Extension API See https://code.visualstudio.com/api for more information
variable version
const version: string;
The version of the editor.
class BranchCoverage
class BranchCoverage {}
Contains coverage information for a branch of a StatementCoverage.
constructor
constructor( executed: number | boolean, location?: Range | Position, label?: string);
Parameter executed
The number of times this branch was executed, or a boolean indicating whether it was executed if the exact count is unknown. If zero or false, the branch will be marked as un-covered.
Parameter location
The branch position.
property executed
executed: number | boolean;
The number of times this branch was executed, or a boolean indicating whether it was executed if the exact count is unknown. If zero or false, the branch will be marked as un-covered.
property label
label?: string;
Label for the branch, used in the context of "the ${label} branch was not taken," for example.
property location
location?: Range | Position;
Branch location.
class Breakpoint
class Breakpoint {}
The base class of all breakpoint types.
constructor
protected constructor( enabled?: boolean, condition?: string, hitCondition?: string, logMessage?: string);
Creates a new breakpoint
Parameter enabled
Is breakpoint enabled.
Parameter condition
Expression for conditional breakpoints
Parameter hitCondition
Expression that controls how many hits of the breakpoint are ignored
Parameter logMessage
Log message to display when breakpoint is hit
property condition
readonly condition?: string;
An optional expression for conditional breakpoints.
property enabled
readonly enabled: boolean;
Is breakpoint enabled.
property hitCondition
readonly hitCondition?: string;
An optional expression that controls how many hits of the breakpoint are ignored.
property id
readonly id: string;
The unique ID of the breakpoint.
property logMessage
readonly logMessage?: string;
An optional message that gets logged when this breakpoint is hit. Embedded expressions within {} are interpolated by the debug adapter.
class CallHierarchyIncomingCall
class CallHierarchyIncomingCall {}
Represents an incoming call, e.g. a caller of a method or constructor.
constructor
constructor(item: CallHierarchyItem, fromRanges: Range[]);
Create a new call object.
Parameter item
The item making the call.
Parameter fromRanges
The ranges at which the calls appear.
property from
from: CallHierarchyItem;
The item that makes the call.
property fromRanges
fromRanges: Range[];
The range at which at which the calls appears. This is relative to the caller denoted by .
class CallHierarchyItem
class CallHierarchyItem {}
Represents programming constructs like functions or constructors in the context of call hierarchy.
constructor
constructor( kind: SymbolKind, name: string, detail: string, uri: Uri, range: Range, selectionRange: Range);
Creates a new call hierarchy item.
property detail
detail?: string;
More detail for this item, e.g. the signature of a function.
property kind
kind: SymbolKind;
The kind of this item.
property name
name: string;
The name of this item.
property range
range: Range;
The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
property selectionRange
selectionRange: Range;
The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. Must be contained by the .
property tags
tags?: readonly SymbolTag[];
Tags for this item.
property uri
uri: Uri;
The resource identifier of this item.
class CallHierarchyOutgoingCall
class CallHierarchyOutgoingCall {}
Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
constructor
constructor(item: CallHierarchyItem, fromRanges: Range[]);
Create a new call object.
Parameter item
The item being called
Parameter fromRanges
The ranges at which the calls appear.
property fromRanges
fromRanges: Range[];
The range at which this item is called. This is the range relative to the caller, e.g the item passed to and not .
property to
to: CallHierarchyItem;
The item that is called.
class CancellationError
class CancellationError extends Error {}
An error type that should be used to signal cancellation of an operation.
This type can be used in response to a being cancelled or when an operation is being cancelled by the executor of that operation.
constructor
constructor();
Creates a new cancellation error.
class CancellationTokenSource
class CancellationTokenSource {}
A cancellation source creates and controls a .
class ChatRequestTurn
class ChatRequestTurn {}
Represents a user request in chat history.
property command
readonly command?: string;
The name of the that was selected for this request.
property participant
readonly participant: string;
The id of the chat participant to which this request was directed.
property prompt
readonly prompt: string;
The prompt as entered by the user.
Information about references used in this request is stored in ChatRequestTurn.references.
*Note* that the of the participant and the are not part of the prompt.
property references
readonly references: ChatPromptReference[];
The references that were used in this message.
class ChatResponseAnchorPart
class ChatResponseAnchorPart {}
Represents a part of a chat response that is an anchor, that is rendered as a link to a target.
constructor
constructor(value: Uri | Location, title?: string);
Create a new ChatResponseAnchorPart.
Parameter value
A uri or location.
Parameter title
An optional title that is rendered with value.
property title
title?: string;
An optional title that is rendered with value.
property value
value: Uri | Location;
The target of this anchor.
class ChatResponseCommandButtonPart
class ChatResponseCommandButtonPart {}
Represents a part of a chat response that is a button that executes a command.
constructor
constructor(value: Command);
Create a new ChatResponseCommandButtonPart.
Parameter value
A Command that will be executed when the button is clicked.
property value
value: Command;
The command that will be executed when the button is clicked.
class ChatResponseFileTreePart
class ChatResponseFileTreePart {}
Represents a part of a chat response that is a file tree.
constructor
constructor(value: ChatResponseFileTree[], baseUri: Uri);
Create a new ChatResponseFileTreePart.
Parameter value
File tree data.
Parameter baseUri
The base uri to which this file tree is relative.
property baseUri
baseUri: Uri;
The base uri to which this file tree is relative
property value
value: ChatResponseFileTree[];
File tree data.
class ChatResponseMarkdownPart
class ChatResponseMarkdownPart {}
Represents a part of a chat response that is formatted as Markdown.
constructor
constructor(value: string | MarkdownString);
Create a new ChatResponseMarkdownPart.
Parameter value
A markdown string or a string that should be interpreted as markdown. The boolean form of MarkdownString.isTrusted is NOT supported.
property value
value: MarkdownString;
A markdown string or a string that should be interpreted as markdown.
class ChatResponseProgressPart
class ChatResponseProgressPart {}
Represents a part of a chat response that is a progress message.
constructor
constructor(value: string);
Create a new ChatResponseProgressPart.
Parameter value
A progress message
property value
value: string;
The progress message
class ChatResponseReferencePart
class ChatResponseReferencePart {}
Represents a part of a chat response that is a reference, rendered separately from the content.
constructor
constructor( value: Uri | Location, iconPath?: Uri | ThemeIcon | { light: Uri; dark: Uri });
Create a new ChatResponseReferencePart.
Parameter value
A uri or location
Parameter iconPath
Icon for the reference shown in UI
property iconPath
iconPath?: Uri | ThemeIcon | { light: Uri; dark: Uri };
The icon for the reference.
property value
value: Uri | Location;
The reference target.
class ChatResponseTurn
class ChatResponseTurn {}
Represents a chat participant's response in chat history.
property command
readonly command?: string;
The name of the command that this response came from.
property participant
readonly participant: string;
The id of the chat participant that this response came from.
property response
readonly response: readonly ( | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart)[];
The content that was received from the chat participant. Only the stream parts that represent actual content (not metadata) are represented.
property result
readonly result: ChatResult;
The result that was received from the chat participant.
class CodeAction
class CodeAction {}
A code action represents a change that can be performed in code, e.g. to fix a problem or to refactor code.
A CodeAction must set either and/or a . If both are supplied, the
edit
is applied first, then the command is executed.
constructor
constructor(title: string, kind?: CodeActionKind);
Creates a new code action.
A code action must have at least a and and/or a .
Parameter title
The title of the code action.
Parameter kind
The kind of the code action.
property command
command?: Command;
A Command this code action executes.
If this command throws an exception, the editor displays the exception message to users in the editor at the current cursor position.
property diagnostics
diagnostics?: Diagnostic[];
that this code action resolves.
property disabled
disabled?: { readonly reason: string };
Marks that the code action cannot currently be applied.
- Disabled code actions are not shown in automatic [lightbulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) code action menu.
- Disabled actions are shown as faded out in the code action menu when the user request a more specific type of code action, such as refactorings.
- If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions) that auto applies a code action and only a disabled code actions are returned, the editor will show the user an error message with
reason
in the editor.
property edit
edit?: WorkspaceEdit;
A this code action performs.
property isPreferred
isPreferred?: boolean;
Marks this as a preferred action. Preferred actions are used by the
auto fix
command and can be targeted by keybindings.A quick fix should be marked preferred if it properly addresses the underlying error. A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
property kind
kind?: CodeActionKind;
of the code action.
Used to filter code actions.
property title
title: string;
A short, human-readable, title for this code action.
class CodeActionKind
class CodeActionKind {}
Kind of a code action.
Kinds are a hierarchical list of identifiers separated by
.
, e.g."refactor.extract.function"
.Code action kinds are used by the editor for UI elements such as the refactoring context menu. Users can also trigger code actions with a specific kind with the
editor.action.codeAction
command.
property Empty
static readonly Empty: CodeActionKind;
Empty kind.
property Notebook
static readonly Notebook: CodeActionKind;
Base kind for all code actions applying to the enitre notebook's scope. CodeActionKinds using this should always begin with
notebook.
This requires that new CodeActions be created for it and contributed via extensions. Pre-existing kinds can not just have the new
notebook.
prefix added to them, as the functionality is unique to the full-notebook scope.Notebook CodeActionKinds can be initialized as either of the following (both resulting in
notebook.source.xyz
): -const newKind = CodeActionKind.Notebook.append(CodeActionKind.Source.append('xyz').value)
-const newKind = CodeActionKind.Notebook.append('source.xyz')
Example Kinds/Actions: -
notebook.source.organizeImports
(might move all imports to a new top cell) -notebook.source.normalizeVariableNames
(might rename all variables to a standardized casing format)
property QuickFix
static readonly QuickFix: CodeActionKind;
Base kind for quickfix actions:
quickfix
.Quick fix actions address a problem in the code and are shown in the normal code action context menu.
property Refactor
static readonly Refactor: CodeActionKind;
Base kind for refactoring actions:
refactor
Refactoring actions are shown in the refactoring context menu.
property RefactorExtract
static readonly RefactorExtract: CodeActionKind;
Base kind for refactoring extraction actions:
refactor.extract
Example extract actions:
- Extract method - Extract function - Extract variable - Extract interface from class - ...
property RefactorInline
static readonly RefactorInline: CodeActionKind;
Base kind for refactoring inline actions:
refactor.inline
Example inline actions:
- Inline function - Inline variable - Inline constant - ...
property RefactorMove
static readonly RefactorMove: CodeActionKind;
Base kind for refactoring move actions:
refactor.move
Example move actions:
- Move a function to a new file - Move a property between classes - Move method to base class - ...
property RefactorRewrite
static readonly RefactorRewrite: CodeActionKind;
Base kind for refactoring rewrite actions:
refactor.rewrite
Example rewrite actions:
- Convert JavaScript function to class - Add or remove parameter - Encapsulate field - Make method static - ...
property Source
static readonly Source: CodeActionKind;
Base kind for source actions:
source
Source code actions apply to the entire file. They must be explicitly requested and will not show in the normal [lightbulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) menu. Source actions can be run on save using
editor.codeActionsOnSave
and are also shown in thesource
context menu.
property SourceFixAll
static readonly SourceFixAll: CodeActionKind;
Base kind for auto-fix source actions:
source.fixAll
.Fix all actions automatically fix errors that have a clear fix that do not require user input. They should not suppress errors or perform unsafe fixes such as generating new types or classes.
property SourceOrganizeImports
static readonly SourceOrganizeImports: CodeActionKind;
Base kind for an organize imports source action:
source.organizeImports
.
property value
readonly value: string;
String value of the kind, e.g.
"refactor.extract.function"
.
method append
append: (parts: string) => CodeActionKind;
Create a new kind by appending a more specific selector to the current kind.
Does not modify the current kind.
method contains
contains: (other: CodeActionKind) => boolean;
Checks if
other
is a sub-kind of thisCodeActionKind
.The kind
"refactor.extract"
for example contains"refactor.extract"
and ``"refactor.extract.function"`, but not"unicorn.refactor.extract"
, or"refactor.extractAll"
orrefactor
.Parameter other
Kind to check.
method intersects
intersects: (other: CodeActionKind) => boolean;
Checks if this code action kind intersects
other
.The kind
"refactor.extract"
for example intersectsrefactor
,"refactor.extract"
and"refactor.extract.function"
, but not"unicorn.refactor.extract"
, or"refactor.extractAll"
.Parameter other
Kind to check.
class CodeLens
class CodeLens {}
A code lens represents a Command that should be shown along with source text, like the number of references, a way to run tests, etc.
A code lens is _unresolved_ when no command is associated to it. For performance reasons the creation of a code lens and resolving should be done to two stages.
See Also
constructor
constructor(range: Range, command?: Command);
Creates a new code lens object.
Parameter range
The range to which this code lens applies.
Parameter command
The command associated to this code lens.
property command
command?: Command;
The command this code lens represents.
property isResolved
readonly isResolved: boolean;
true
when there is a command associated.
property range
range: Range;
The range in which this code lens is valid. Should only span a single line.
class Color
class Color {}
Represents a color in RGBA space.
constructor
constructor(red: number, green: number, blue: number, alpha: number);
Creates a new color instance.
Parameter red
The red component.
Parameter green
The green component.
Parameter blue
The blue component.
Parameter alpha
The alpha component.
property alpha
readonly alpha: number;
The alpha component of this color in the range [0-1].
property blue
readonly blue: number;
The blue component of this color in the range [0-1].
property green
readonly green: number;
The green component of this color in the range [0-1].
property red
readonly red: number;
The red component of this color in the range [0-1].
class ColorInformation
class ColorInformation {}
Represents a color range from a document.
constructor
constructor(range: Range, color: Color);
Creates a new color range.
Parameter range
The range the color appears in. Must not be empty.
Parameter color
The value of the color.
property color
color: Color;
The actual color value for this color range.
property range
range: Range;
The range in the document where this color appears.
class ColorPresentation
class ColorPresentation {}
A color presentation object describes how a should be represented as text and what edits are required to refer to it from source code.
For some languages one color can have multiple presentations, e.g. css can represent the color red with the constant
Red
, the hex-value#ff0000
, or in rgba and hsla forms. In csharp other representations apply, e.g.System.Drawing.Color.Red
.
constructor
constructor(label: string);
Creates a new color presentation.
Parameter label
The label of this color presentation.
property additionalTextEdits
additionalTextEdits?: TextEdit[];
An optional array of additional that are applied when selecting this color presentation. Edits must not overlap with the main nor with themselves.
property label
label: string;
The label of this color presentation. It will be shown on the color picker header. By default this is also the text that is inserted when selecting this color presentation.
property textEdit
textEdit?: TextEdit;
An which is applied to a document when selecting this presentation for the color. When
falsy
the is used.
class CompletionItem
class CompletionItem {}
A completion item represents a text snippet that is proposed to complete text that is being typed.
It is sufficient to create a completion item from just a . In that case the completion item will replace the until the cursor with the given label or . Otherwise the given is used.
When selecting a completion item in the editor its defined or synthesized text edit will be applied to *all* cursors/selections whereas will be applied as provided.
See Also
constructor
constructor(label: string | CompletionItemLabel, kind?: CompletionItemKind);
Creates a new completion item.
Completion items must have at least a which then will be used as insert text as well as for sorting and filtering.
Parameter label
The label of the completion.
Parameter kind
The of the completion.
property additionalTextEdits
additionalTextEdits?: TextEdit[];
An optional array of additional that are applied when selecting this completion. Edits must not overlap with the main nor with themselves.
property command
command?: Command;
An optional Command that is executed *after* inserting this completion. *Note* that additional modifications to the current document should be described with the -property.
property commitCharacters
commitCharacters?: string[];
An optional set of characters that when pressed while this completion is active will accept it first and then type that character. *Note* that all commit characters should have
length=1
and that superfluous characters will be ignored.
property detail
detail?: string;
A human-readable string with additional information about this item, like type or symbol information.
property documentation
documentation?: string | MarkdownString;
A human-readable string that represents a doc-comment.
property filterText
filterText?: string;
A string that should be used when filtering a set of completion items. When
falsy
the is used.Note that the filter text is matched against the leading word (prefix) which is defined by the -property.
property insertText
insertText?: string | SnippetString;
A string or snippet that should be inserted in a document when selecting this completion. When
falsy
the is used.
property keepWhitespace
keepWhitespace?: boolean;
Keep whitespace of the as is. By default, the editor adjusts leading whitespace of new lines so that they match the indentation of the line for which the item is accepted - setting this to
true
will prevent that.
property kind
kind?: CompletionItemKind;
The kind of this completion item. Based on the kind an icon is chosen by the editor.
property label
label: string | CompletionItemLabel;
The label of this completion item. By default this is also the text that is inserted when selecting this completion.
property preselect
preselect?: boolean;
Select this item when showing. *Note* that only one completion item can be selected and that the editor decides which item that is. The rule is that the *first* item of those that match best is selected.
property range
range?: Range | { inserting: Range; replacing: Range };
A range or a insert and replace range selecting the text that should be replaced by this completion item.
When omitted, the range of the is used as replace-range and as insert-range the start of the to the current position is used.
*Note 1:* A range must be a and it must the position at which completion has been . *Note 2:* A insert range must be a prefix of a replace range, that means it must be contained and starting at the same position.
property sortText
sortText?: string;
A string that should be used when comparing this item with other items. When
falsy
the is used.Note that
sortText
is only used for the initial ordering of completion items. When having a leading word (prefix) ordering is based on how well completions match that prefix and the initial ordering is only used when completions match equally well. The prefix is defined by the -property and can therefore be different for each completion.
property tags
tags?: readonly CompletionItemTag[];
Tags for this completion item.
property textEdit
textEdit?: TextEdit;
Deprecated
Use
CompletionItem.insertText
andCompletionItem.range
instead.An which is applied to a document when selecting this completion. When an edit is provided the value of is ignored.
The Range of the edit must be single-line and on the same line completions were at.
class CompletionList
class CompletionList<T extends CompletionItem = CompletionItem> {}
Represents a collection of to be presented in the editor.
constructor
constructor(items?: T[], isIncomplete?: boolean);
Creates a new completion list.
Parameter items
The completion items.
Parameter isIncomplete
The list is not complete.
property isIncomplete
isIncomplete?: boolean;
This list is not complete. Further typing should result in recomputing this list.
property items
items: T[];
The completion items.
class CustomExecution
class CustomExecution {}
Class used to execute an extension callback as a task.
constructor
constructor( callback: (resolvedDefinition: TaskDefinition) => Thenable<Pseudoterminal>);
Constructs a CustomExecution task object. The callback will be executed when the task is run, at which point the extension should return the Pseudoterminal it will "run in". The task should wait to do further execution until Pseudoterminal.open is called. Task cancellation should be handled using Pseudoterminal.close. When the task is complete fire Pseudoterminal.onDidClose.
Parameter callback
The callback that will be called when the task is started by a user. Any ${} style variables that were in the task definition will be resolved and passed into the callback as
resolvedDefinition
.
class DataTransfer
class DataTransfer implements Iterable<[mimeType: string, item: DataTransferItem]> {}
A map containing a mapping of the mime type of the corresponding transferred data.
Drag and drop controllers that implement can add additional mime types to the data transfer. These additional mime types will only be included in the
handleDrop
when the the drag was initiated from an element in the same drag and drop controller.
method [Symbol.iterator]
[Symbol.iterator]: () => IterableIterator< [mimeType: string, item: DataTransferItem]>;
Get a new iterator with the
[mime, item]
pairs for each element in this data transfer.
method forEach
forEach: ( callbackfn: ( item: DataTransferItem, mimeType: string, dataTransfer: DataTransfer ) => void, thisArg?: any) => void;
Allows iteration through the data transfer items.
Parameter callbackfn
Callback for iteration through the data transfer items.
Parameter thisArg
The
this
context used when invoking the handler function.
method get
get: (mimeType: string) => DataTransferItem | undefined;
Retrieves the data transfer item for a given mime type.
Parameter mimeType
The mime type to get the data transfer item for, such as
text/plain
orimage/png
. Mimes type look ups are case-insensitive.Special mime types: -
text/uri-list
— A string withtoString()
ed Uris separated by\r\n
. To specify a cursor position in the file, set the Uri's fragment toL3,5
, where 3 is the line number and 5 is the column number.
method set
set: (mimeType: string, value: DataTransferItem) => void;
Sets a mime type to data transfer item mapping.
Parameter mimeType
The mime type to set the data for. Mimes types stored in lower case, with case-insensitive looks up.
Parameter value
The data transfer item for the given mime type.
class DataTransferItem
class DataTransferItem {}
Encapsulates data transferred during drag and drop operations.
constructor
constructor(value: any);
Parameter value
Custom data stored on this item. Can be retrieved using .
property value
readonly value: any;
Custom data stored on this item.
You can use
value
to share data across operations. The original object can be retrieved so long as the extension that created theDataTransferItem
runs in the same extension host.
method asFile
asFile: () => DataTransferFile | undefined;
Try getting the associated with this data transfer item.
Note that the file object is only valid for the scope of the drag and drop operation.
Returns
The file for the data transfer or
undefined
if the item is either not a file or the file data cannot be accessed.
method asString
asString: () => Thenable<string>;
Get a string representation of this item.
If is an object, this returns the result of json stringifying value.
class DebugAdapterExecutable
class DebugAdapterExecutable {}
Represents a debug adapter executable and optional arguments and runtime options passed to it.
constructor
constructor( command: string, args?: string[], options?: DebugAdapterExecutableOptions);
Creates a description for a debug adapter based on an executable program.
Parameter command
The command or executable path that implements the debug adapter.
Parameter args
Optional arguments to be passed to the command or executable.
Parameter options
Optional options to be used when starting the command or executable.
property args
readonly args: string[];
The arguments passed to the debug adapter executable. Defaults to an empty array.
property command
readonly command: string;
The command or path of the debug adapter executable. A command must be either an absolute path of an executable or the name of an command to be looked up via the PATH environment variable. The special value 'node' will be mapped to the editor's built-in Node.js runtime.
property options
readonly options?: DebugAdapterExecutableOptions;
Optional options to be used when the debug adapter is started. Defaults to undefined.
class DebugAdapterInlineImplementation
class DebugAdapterInlineImplementation {}
A debug adapter descriptor for an inline implementation.
constructor
constructor(implementation: DebugAdapter);
Create a descriptor for an inline implementation of a debug adapter.
class DebugAdapterNamedPipeServer
class DebugAdapterNamedPipeServer {}
Represents a debug adapter running as a Named Pipe (on Windows)/UNIX Domain Socket (on non-Windows) based server.
constructor
constructor(path: string);
Create a description for a debug adapter running as a Named Pipe (on Windows)/UNIX Domain Socket (on non-Windows) based server.
property path
readonly path: string;
The path to the NamedPipe/UNIX Domain Socket.
class DebugAdapterServer
class DebugAdapterServer {}
Represents a debug adapter running as a socket based server.
constructor
constructor(port: number, host?: string);
Create a description for a debug adapter running as a socket based server.
property host
readonly host?: string;
The host.
property port
readonly port: number;
The port.
class DebugStackFrame
class DebugStackFrame {}
Represents a stack frame in a debug session.
class DebugThread
class DebugThread {}
Represents a thread in a debug session.
class DeclarationCoverage
class DeclarationCoverage {}
Contains coverage information for a declaration. Depending on the reporter and language, this may be types such as functions, methods, or namespaces.
constructor
constructor( name: string, executed: number | boolean, location: Range | Position);
Parameter executed
The number of times this declaration was executed, or a boolean indicating whether it was executed if the exact count is unknown. If zero or false, the declaration will be marked as un-covered.
Parameter location
The declaration position.
property executed
executed: number | boolean;
The number of times this declaration was executed, or a boolean indicating whether it was executed if the exact count is unknown. If zero or false, the declaration will be marked as un-covered.
property location
location: Range | Position;
Declaration location.
property name
name: string;
Name of the declaration.
class Diagnostic
class Diagnostic {}
Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a file.
constructor
constructor(range: Range, message: string, severity?: DiagnosticSeverity);
Creates a new diagnostic object.
Parameter range
The range to which this diagnostic applies.
Parameter message
The human-readable message.
Parameter severity
The severity, default is .
property code
code?: string | number | { value: string | number; target: Uri };
A code or identifier for this diagnostic. Should be used for later processing, e.g. when providing .
property message
message: string;
The human-readable message.
property range
range: Range;
The range to which this diagnostic applies.
property relatedInformation
relatedInformation?: DiagnosticRelatedInformation[];
An array of related diagnostic information, e.g. when symbol-names within a scope collide all definitions can be marked via this property.
property severity
severity: DiagnosticSeverity;
The severity, default is .
property source
source?: string;
A human-readable string describing the source of this diagnostic, e.g. 'typescript' or 'super lint'.
property tags
tags?: DiagnosticTag[];
Additional metadata about the diagnostic.
class DiagnosticRelatedInformation
class DiagnosticRelatedInformation {}
Represents a related message and source code location for a diagnostic. This should be used to point to code locations that cause or related to a diagnostics, e.g. when duplicating a symbol in a scope.
constructor
constructor(location: Location, message: string);
Creates a new related diagnostic information object.
Parameter location
The location.
Parameter message
The message.
property location
location: Location;
The location of this related diagnostic information.
property message
message: string;
The message of this related diagnostic information.
class Disposable
class Disposable {}
Represents a type which can release resources, such as event listening or a timer.
constructor
constructor(callOnDispose: () => any);
Creates a new disposable that calls the provided function on dispose.
*Note* that an asynchronous function is not awaited.
Parameter callOnDispose
Function that disposes something.
method dispose
dispose: () => any;
Dispose this object.
method from
static from: (...disposableLikes: { dispose: () => any }[]) => Disposable;
Combine many disposable-likes into one. You can use this method when having objects with a dispose function which aren't instances of
Disposable
.Parameter disposableLikes
Objects that have at least a
dispose
-function member. Note that asynchronous dispose-functions aren't awaited.Returns
Returns a new disposable which, upon dispose, will dispose all provided disposables.
class DocumentDropEdit
class DocumentDropEdit {}
An edit operation applied .
constructor
constructor(insertText: string | SnippetString);
Parameter insertText
The text or snippet to insert at the drop location.
property additionalEdit
additionalEdit?: WorkspaceEdit;
An optional additional edit to apply on drop.
property insertText
insertText: string | SnippetString;
The text or snippet to insert at the drop location.
class DocumentHighlight
class DocumentHighlight {}
A document highlight is a range inside a text document which deserves special attention. Usually a document highlight is visualized by changing the background color of its range.
constructor
constructor(range: Range, kind?: DocumentHighlightKind);
Creates a new document highlight object.
Parameter range
The range the highlight applies to.
Parameter kind
The highlight kind, default is .
property kind
kind?: DocumentHighlightKind;
The highlight kind, default is .
property range
range: Range;
The range this highlight applies to.
class DocumentLink
class DocumentLink {}
A document link is a range in a text document that links to an internal or external resource, like another text document or a web site.
constructor
constructor(range: Range, target?: Uri);
Creates a new document link.
Parameter range
The range the document link applies to. Must not be empty.
Parameter target
The uri the document link points to.
property range
range: Range;
The range this link applies to.
property target
target?: Uri;
The uri this link points to.
property tooltip
tooltip?: string;
The tooltip text when you hover over this link.
If a tooltip is provided, is will be displayed in a string that includes instructions on how to trigger the link, such as
{0} (ctrl + click)
. The specific instructions vary depending on OS, user settings, and localization.
class DocumentSymbol
class DocumentSymbol {}
Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, e.g. the range of an identifier.
constructor
constructor( name: string, detail: string, kind: SymbolKind, range: Range, selectionRange: Range);
Creates a new document symbol.
Parameter name
The name of the symbol.
Parameter detail
Details for the symbol.
Parameter kind
The kind of the symbol.
Parameter range
The full range of the symbol.
Parameter selectionRange
The range that should be reveal.
property children
children: DocumentSymbol[];
Children of this symbol, e.g. properties of a class.
property detail
detail: string;
More detail for this symbol, e.g. the signature of a function.
property kind
kind: SymbolKind;
The kind of this symbol.
property name
name: string;
The name of this symbol.
property range
range: Range;
The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
property selectionRange
selectionRange: Range;
The range that should be selected and reveal when this symbol is being picked, e.g. the name of a function. Must be contained by the .
property tags
tags?: readonly SymbolTag[];
Tags for this symbol.
class EvaluatableExpression
class EvaluatableExpression {}
An EvaluatableExpression represents an expression in a document that can be evaluated by an active debugger or runtime. The result of this evaluation is shown in a tooltip-like widget. If only a range is specified, the expression will be extracted from the underlying document. An optional expression can be used to override the extracted expression. In this case the range is still used to highlight the range in the document.
constructor
constructor(range: Range, expression?: string);
Creates a new evaluatable expression object.
Parameter range
The range in the underlying document from which the evaluatable expression is extracted.
Parameter expression
If specified overrides the extracted expression.
property expression
readonly expression?: string;
property range
readonly range: Range;
class EventEmitter
class EventEmitter<T> {}
An event emitter can be used to create and manage an Event for others to subscribe to. One emitter always owns one event.
Use this class if you want to provide event from within your extension, for instance inside a TextDocumentContentProvider or when providing API to other extensions.
property event
event: Event<T>;
The event listeners can subscribe to.
method dispose
dispose: () => void;
Dispose this object and free resources.
method fire
fire: (data: T) => void;
Notify all subscribers of the . Failure of one or more listener will not fail this function call.
Parameter data
The event object.
class FileCoverage
class FileCoverage {}
Contains coverage metadata for a file.
constructor
constructor( uri: Uri, statementCoverage: TestCoverageCount, branchCoverage?: TestCoverageCount, declarationCoverage?: TestCoverageCount);
Parameter uri
Covered file URI
Parameter statementCoverage
Statement coverage information. If the reporter does not provide statement coverage information, this can instead be used to represent line coverage.
Parameter branchCoverage
Branch coverage information
Parameter declarationCoverage
Declaration coverage information
property branchCoverage
branchCoverage?: TestCoverageCount;
Branch coverage information.
property declarationCoverage
declarationCoverage?: TestCoverageCount;
Declaration coverage information. Depending on the reporter and language, this may be types such as functions, methods, or namespaces.
property statementCoverage
statementCoverage: TestCoverageCount;
Statement coverage information. If the reporter does not provide statement coverage information, this can instead be used to represent line coverage.
property uri
readonly uri: Uri;
File URI.
method fromDetails
static fromDetails: ( uri: Uri, details: readonly FileCoverageDetail[]) => FileCoverage;
Creates a FileCoverage instance with counts filled in from the coverage details.
Parameter uri
Covered file URI
Parameter detailed
Detailed coverage information
class FileDecoration
class FileDecoration {}
A file decoration represents metadata that can be rendered with a file.
constructor
constructor(badge?: string, tooltip?: string, color?: ThemeColor);
Creates a new decoration.
Parameter badge
A letter that represents the decoration.
Parameter tooltip
The tooltip of the decoration.
Parameter color
The color of the decoration.
property badge
badge?: string;
A very short string that represents this decoration.
property color
color?: ThemeColor;
The color of this decoration.
property propagate
propagate?: boolean;
A flag expressing that this decoration should be propagated to its parents.
property tooltip
tooltip?: string;
A human-readable tooltip for this decoration.
class FileSystemError
class FileSystemError extends Error {}
A type that filesystem providers should use to signal errors.
This class has factory methods for common error-cases, like
FileNotFound
when a file or folder doesn't exist, use them like so:throw vscode.FileSystemError.FileNotFound(someUri);
constructor
constructor(messageOrUri?: string | Uri);
Creates a new filesystem error.
Parameter messageOrUri
Message or uri.
property code
readonly code: string;
A code that identifies this error.
Possible values are names of errors, like , or
Unknown
for unspecified errors.
method FileExists
static FileExists: (messageOrUri?: string | Uri) => FileSystemError;
Create an error to signal that a file or folder already exists, e.g. when creating but not overwriting a file.
Parameter messageOrUri
Message or uri.
method FileIsADirectory
static FileIsADirectory: (messageOrUri?: string | Uri) => FileSystemError;
Create an error to signal that a file is a folder.
Parameter messageOrUri
Message or uri.
method FileNotADirectory
static FileNotADirectory: (messageOrUri?: string | Uri) => FileSystemError;
Create an error to signal that a file is not a folder.
Parameter messageOrUri
Message or uri.
method FileNotFound
static FileNotFound: (messageOrUri?: string | Uri) => FileSystemError;
Create an error to signal that a file or folder wasn't found.
Parameter messageOrUri
Message or uri.
method NoPermissions
static NoPermissions: (messageOrUri?: string | Uri) => FileSystemError;
Create an error to signal that an operation lacks required permissions.
Parameter messageOrUri
Message or uri.
method Unavailable
static Unavailable: (messageOrUri?: string | Uri) => FileSystemError;
Create an error to signal that the file system is unavailable or too busy to complete a request.
Parameter messageOrUri
Message or uri.
class FoldingRange
class FoldingRange {}
A line based folding range. To be valid, start and end line must be bigger than zero and smaller than the number of lines in the document. Invalid ranges will be ignored.
constructor
constructor(start: number, end: number, kind?: FoldingRangeKind);
Creates a new folding range.
Parameter start
The start line of the folded range.
Parameter end
The end line of the folded range.
Parameter kind
The kind of the folding range.
property end
end: number;
The zero-based end line of the range to fold. The folded area ends with the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document.
property kind
kind?: FoldingRangeKind;
Describes the of the folding range such as or . The kind is used to categorize folding ranges and used by commands like 'Fold all comments'. See FoldingRangeKind for an enumeration of all kinds. If not set, the range is originated from a syntax element.
property start
start: number;
The zero-based start line of the range to fold. The folded area starts after the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document.
class FunctionBreakpoint
class FunctionBreakpoint extends Breakpoint {}
A breakpoint specified by a function name.
constructor
constructor( functionName: string, enabled?: boolean, condition?: string, hitCondition?: string, logMessage?: string);
Create a new function breakpoint.
property functionName
readonly functionName: string;
The name of the function to which this breakpoint is attached.
class Hover
class Hover {}
A hover represents additional information for a symbol or word. Hovers are rendered in a tooltip-like widget.
constructor
constructor( contents: MarkdownString | MarkedString | (MarkdownString | MarkedString)[], range?: Range);
Creates a new hover object.
Parameter contents
The contents of the hover.
Parameter range
The range to which the hover applies.
property contents
contents: (MarkdownString | MarkedString)[];
The contents of this hover.
property range
range?: Range;
The range to which this hover applies. When missing, the editor will use the range at the current position or the current position itself.
class InlayHint
class InlayHint {}
Inlay hint information.
constructor
constructor( position: Position, label: string | InlayHintLabelPart[], kind?: InlayHintKind);
Creates a new inlay hint.
Parameter position
The position of the hint.
Parameter label
The label of the hint.
Parameter kind
The of the hint.
property kind
kind?: InlayHintKind;
The kind of this hint. The inlay hint kind defines the appearance of this inlay hint.
property label
label: string | InlayHintLabelPart[];
The label of this hint. A human readable string or an array of .
*Note* that neither the string nor the label part can be empty.
property paddingLeft
paddingLeft?: boolean;
Render padding before the hint. Padding will use the editor's background color, not the background color of the hint itself. That means padding can be used to visually align/separate an inlay hint.
property paddingRight
paddingRight?: boolean;
Render padding after the hint. Padding will use the editor's background color, not the background color of the hint itself. That means padding can be used to visually align/separate an inlay hint.
property position
position: Position;
The position of this hint.
property textEdits
textEdits?: TextEdit[];
Optional that are performed when accepting this inlay hint. The default gesture for accepting an inlay hint is the double click.
*Note* that edits are expected to change the document so that the inlay hint (or its nearest variant) is now part of the document and the inlay hint itself is now obsolete.
*Note* that this property can be set late during of inlay hints.
property tooltip
tooltip?: string | MarkdownString;
The tooltip text when you hover over this item.
*Note* that this property can be set late during of inlay hints.
class InlayHintLabelPart
class InlayHintLabelPart {}
An inlay hint label part allows for interactive and composite labels of inlay hints.
constructor
constructor(value: string);
Creates a new inlay hint label part.
Parameter value
The value of the part.
property command
command?: Command;
An optional command for this label part.
The editor renders parts with commands as clickable links. The command is added to the context menu when a label part defines and .
*Note* that this property can be set late during of inlay hints.
property location
location?: Location;
An optional that represents this label part.
The editor will use this location for the hover and for code navigation features: This part will become a clickable link that resolves to the definition of the symbol at the given location (not necessarily the location itself), it shows the hover that shows at the given location, and it shows a context menu with further code navigation commands.
*Note* that this property can be set late during of inlay hints.
property tooltip
tooltip?: string | MarkdownString;
The tooltip text when you hover over this label part.
*Note* that this property can be set late during of inlay hints.
property value
value: string;
The value of this label part.
class InlineCompletionItem
class InlineCompletionItem {}
An inline completion item represents a text snippet that is proposed inline to complete text that is being typed.
See Also
constructor
constructor( insertText: string | SnippetString, range?: Range, command?: Command);
Creates a new inline completion item.
Parameter insertText
The text to replace the range with.
Parameter range
The range to replace. If not set, the word at the requested position will be used.
Parameter command
An optional Command that is executed *after* inserting this completion.
property command
command?: Command;
An optional Command that is executed *after* inserting this completion.
property filterText
filterText?: string;
A text that is used to decide if this inline completion should be shown. When
falsy
the InlineCompletionItem.insertText is used.An inline completion is shown if the text to replace is a prefix of the filter text.
property insertText
insertText: string | SnippetString;
The text to replace the range with. Must be set. Is used both for the preview and the accept operation.
property range
range?: Range;
The range to replace. Must begin and end on the same line.
Prefer replacements over insertions to provide a better experience when the user deletes typed text.
class InlineCompletionList
class InlineCompletionList {}
Represents a collection of to be presented in the editor.
constructor
constructor(items: InlineCompletionItem[]);
Creates a new list of inline completion items.
property items
items: InlineCompletionItem[];
The inline completion items.
class InlineValueEvaluatableExpression
class InlineValueEvaluatableExpression {}
Provide an inline value through an expression evaluation. If only a range is specified, the expression will be extracted from the underlying document. An optional expression can be used to override the extracted expression.
constructor
constructor(range: Range, expression?: string);
Creates a new InlineValueEvaluatableExpression object.
Parameter range
The range in the underlying document from which the evaluatable expression is extracted.
Parameter expression
If specified overrides the extracted expression.
property expression
readonly expression?: string;
If specified the expression overrides the extracted expression.
property range
readonly range: Range;
The document range for which the inline value applies. The range is used to extract the evaluatable expression from the underlying document.
class InlineValueText
class InlineValueText {}
Provide inline value as text.
constructor
constructor(range: Range, text: string);
Creates a new InlineValueText object.
Parameter range
The document line where to show the inline value.
Parameter text
The value to be shown for the line.
property range
readonly range: Range;
The document range for which the inline value applies.
property text
readonly text: string;
The text of the inline value.
class InlineValueVariableLookup
class InlineValueVariableLookup {}
Provide inline value through a variable lookup. If only a range is specified, the variable name will be extracted from the underlying document. An optional variable name can be used to override the extracted name.
constructor
constructor(range: Range, variableName?: string, caseSensitiveLookup?: boolean);
Creates a new InlineValueVariableLookup object.
Parameter range
The document line where to show the inline value.
Parameter variableName
The name of the variable to look up.
Parameter caseSensitiveLookup
How to perform the lookup. If missing lookup is case sensitive.
property caseSensitiveLookup
readonly caseSensitiveLookup: boolean;
How to perform the lookup.
property range
readonly range: Range;
The document range for which the inline value applies. The range is used to extract the variable name from the underlying document.
property variableName
readonly variableName?: string;
If specified the name of the variable to look up.
class LanguageModelChatMessage
class LanguageModelChatMessage {}
Represents a message in a chat. Can assume different roles, like user or assistant.
constructor
constructor(role: LanguageModelChatMessageRole, content: string, name?: string);
Create a new user message.
Parameter role
The role of the message.
Parameter content
The content of the message.
Parameter name
The optional name of a user for the message.
property content
content: string;
The content of this message.
property name
name: string;
The optional name of a user for this message.
property role
role: LanguageModelChatMessageRole;
The role of this message.
method Assistant
static Assistant: (content: string, name?: string) => LanguageModelChatMessage;
Utility to create a new assistant message.
Parameter content
The content of the message.
Parameter name
The optional name of a user for the message.
method User
static User: (content: string, name?: string) => LanguageModelChatMessage;
Utility to create a new user message.
Parameter content
The content of the message.
Parameter name
The optional name of a user for the message.
class LanguageModelError
class LanguageModelError extends Error {}
An error type for language model specific errors.
Consumers of language models should check the code property to determine specific failure causes, like
if(someError.code === vscode.LanguageModelError.NotFound.name) {...}
for the case of referring to an unknown language model. For unspecified errors thecause
-property will contain the actual error.
property code
readonly code: string;
A code that identifies this error.
Possible values are names of errors, like , or
Unknown
for unspecified errors from the language model itself. In the latter case thecause
-property will contain the actual error.
method Blocked
static Blocked: (message?: string) => LanguageModelError;
The requestor is blocked from using this language model.
method NoPermissions
static NoPermissions: (message?: string) => LanguageModelError;
The requestor does not have permissions to use this language model
method NotFound
static NotFound: (message?: string) => LanguageModelError;
The language model does not exist.
class LinkedEditingRanges
class LinkedEditingRanges {}
Represents a list of ranges that can be edited together along with a word pattern to describe valid range contents.
constructor
constructor(ranges: Range[], wordPattern?: RegExp);
Create a new linked editing ranges object.
Parameter ranges
A list of ranges that can be edited together
Parameter wordPattern
An optional word pattern that describes valid contents for the given ranges
property ranges
readonly ranges: Range[];
A list of ranges that can be edited together. The ranges must have identical length and text content. The ranges cannot overlap.
property wordPattern
readonly wordPattern: RegExp;
An optional word pattern that describes valid contents for the given ranges. If no pattern is provided, the language configuration's word pattern will be used.
class Location
class Location {}
Represents a location inside a resource, such as a line inside a text file.
constructor
constructor(uri: Uri, rangeOrPosition: Range | Position);
Creates a new location object.
Parameter uri
The resource identifier.
Parameter rangeOrPosition
The range or position. Positions will be converted to an empty range.
property range
range: Range;
The document range of this location.
property uri
uri: Uri;
The resource identifier of this location.
class MarkdownString
class MarkdownString {}
Human-readable text that supports formatting via the [markdown syntax](https://commonmark.org).
Rendering of via the
$(<name>)
-syntax is supported when the is set totrue
.Rendering of embedded html is supported when is set to
true
.
constructor
constructor(value?: string, supportThemeIcons?: boolean);
Creates a new markdown string with the given value.
Parameter value
Optional, initial value.
Parameter supportThemeIcons
Optional, Specifies whether are supported within the .
property baseUri
baseUri?: Uri;
Uri that relative paths are resolved relative to.
If the
baseUri
ends with/
, it is considered a directory and relative paths in the markdown are resolved relative to that directory:const md = new vscode.MarkdownString(`[link](./file.js)`);md.baseUri = vscode.Uri.file('/path/to/dir/');// Here 'link' in the rendered markdown resolves to '/path/to/dir/file.js'If the
baseUri
is a file, relative paths in the markdown are resolved relative to the parent dir of that file:const md = new vscode.MarkdownString(`[link](./file.js)`);md.baseUri = vscode.Uri.file('/path/to/otherFile.js');// Here 'link' in the rendered markdown resolves to '/path/to/file.js'
property isTrusted
isTrusted?: boolean | { readonly enabledCommands: readonly string[] };
Indicates that this markdown string is from a trusted source. Only *trusted* markdown supports links that execute commands, e.g.
[Run it](command:myCommandId)
.Defaults to
false
(commands are disabled).
property supportHtml
supportHtml?: boolean;
Indicates that this markdown string can contain raw html tags. Defaults to
false
.When
supportHtml
is false, the markdown renderer will strip out any raw html tags that appear in the markdown text. This means you can only use markdown syntax for rendering.When
supportHtml
is true, the markdown render will also allow a safe subset of html tags and attributes to be rendered. See https://github.com/microsoft/vscode/blob/6d2920473c6f13759c978dd89104c4270a83422d/src/vs/base/browser/markdownRenderer.ts#L296 for a list of all supported tags and attributes.
property supportThemeIcons
supportThemeIcons?: boolean;
Indicates that this markdown string can contain , e.g.
$(zap)
.
property value
value: string;
The markdown string.
method appendCodeblock
appendCodeblock: (value: string, language?: string) => MarkdownString;
Appends the given string as codeblock using the provided language.
Parameter value
A code snippet.
Parameter language
An optional .
method appendMarkdown
appendMarkdown: (value: string) => MarkdownString;
Appends the given string 'as is' to this markdown string. When is
true
, in thevalue
will be iconified.Parameter value
Markdown string.
method appendText
appendText: (value: string) => MarkdownString;
Appends and escapes the given string to this markdown string.
Parameter value
Plain text.
class NotebookCellData
class NotebookCellData {}
NotebookCellData is the raw representation of notebook cells. Its is part of .
constructor
constructor(kind: NotebookCellKind, value: string, languageId: string);
Create new cell data. Minimal cell data specifies its kind, its source value, and the language identifier of its source.
Parameter kind
The kind.
Parameter value
The source value.
Parameter languageId
The language identifier of the source value.
property executionSummary
executionSummary?: NotebookCellExecutionSummary;
The execution summary of this cell data.
property kind
kind: NotebookCellKind;
The of this cell data.
property languageId
languageId: string;
The language identifier of the source value of this cell data. Any value from is possible.
property metadata
metadata?: { [key: string]: any };
Arbitrary metadata of this cell data. Can be anything but must be JSON-stringifyable.
property outputs
outputs?: NotebookCellOutput[];
The outputs of this cell data.
property value
value: string;
The source value of this cell data - either source code or formatted text.
class NotebookCellOutput
class NotebookCellOutput {}
Notebook cell output represents a result of executing a cell. It is a container type for multiple where contained items represent the same result but use different MIME types.
constructor
constructor(items: NotebookCellOutputItem[], metadata?: { [key: string]: any });
Create new notebook output.
Parameter items
Notebook output items.
Parameter metadata
Optional metadata.
property items
items: NotebookCellOutputItem[];
The output items of this output. Each item must represent the same result. _Note_ that repeated MIME types per output is invalid and that the editor will just pick one of them.
new vscode.NotebookCellOutput([vscode.NotebookCellOutputItem.text('Hello', 'text/plain'),vscode.NotebookCellOutputItem.text('<i>Hello</i>', 'text/html'),vscode.NotebookCellOutputItem.text('_Hello_', 'text/markdown'),vscode.NotebookCellOutputItem.text('Hey', 'text/plain'), // INVALID: repeated type, editor will pick just one])
property metadata
metadata?: { [key: string]: any };
Arbitrary metadata for this cell output. Can be anything but must be JSON-stringifyable.
class NotebookCellOutputItem
class NotebookCellOutputItem {}
One representation of a , defined by MIME type and data.
constructor
constructor(data: Uint8Array, mime: string);
Create a new notebook cell output item.
Parameter data
The value of the output item.
Parameter mime
The mime type of the output item.
property data
data: Uint8Array;
The data of this output item. Must always be an array of unsigned 8-bit integers.
property mime
mime: string;
The mime type which determines how the -property is interpreted.
Notebooks have built-in support for certain mime-types, extensions can add support for new types and override existing types.
method error
static error: (value: Error) => NotebookCellOutputItem;
Factory function to create a
NotebookCellOutputItem
that uses uses theapplication/vnd.code.notebook.error
mime type.Parameter value
An error object.
Returns
A new output item object.
method json
static json: (value: any, mime?: string) => NotebookCellOutputItem;
Factory function to create a
NotebookCellOutputItem
from a JSON object.*Note* that this function is not expecting "stringified JSON" but an object that can be stringified. This function will throw an error when the passed value cannot be JSON-stringified.
Parameter value
A JSON-stringifyable value.
Parameter mime
Optional MIME type, defaults to
application/json
Returns
A new output item object.
method stderr
static stderr: (value: string) => NotebookCellOutputItem;
Factory function to create a
NotebookCellOutputItem
that uses uses theapplication/vnd.code.notebook.stderr
mime type.Parameter value
A string.
Returns
A new output item object.
method stdout
static stdout: (value: string) => NotebookCellOutputItem;
Factory function to create a
NotebookCellOutputItem
that uses uses theapplication/vnd.code.notebook.stdout
mime type.Parameter value
A string.
Returns
A new output item object.
method text
static text: (value: string, mime?: string) => NotebookCellOutputItem;
Factory function to create a
NotebookCellOutputItem
from a string.*Note* that an UTF-8 encoder is used to create bytes for the string.
Parameter value
A string.
Parameter mime
Optional MIME type, defaults to
text/plain
.Returns
A new output item object.
class NotebookCellStatusBarItem
class NotebookCellStatusBarItem {}
A contribution to a cell's status bar
constructor
constructor(text: string, alignment: NotebookCellStatusBarAlignment);
Creates a new NotebookCellStatusBarItem.
Parameter text
The text to show for the item.
Parameter alignment
Whether the item is aligned to the left or right.
property accessibilityInformation
accessibilityInformation?: AccessibilityInformation;
Accessibility information used when a screen reader interacts with this item.
property alignment
alignment: NotebookCellStatusBarAlignment;
Whether the item is aligned to the left or right.
property command
command?: string | Command;
An optional or identifier of a command to run on click.
The command must be .
Note that if this is a object, only the and are used by the editor.
property priority
priority?: number;
The priority of the item. A higher value item will be shown more to the left.
property text
text: string;
The text to show for the item.
property tooltip
tooltip?: string;
A tooltip to show when the item is hovered.
class NotebookData
class NotebookData {}
Raw representation of a notebook.
Extensions are responsible for creating so that the editor can create a .
See Also
constructor
constructor(cells: NotebookCellData[]);
Create new notebook data.
Parameter cells
An array of cell data.
property cells
cells: NotebookCellData[];
The cell data of this notebook data.
property metadata
metadata?: { [key: string]: any };
Arbitrary metadata of notebook data.
class NotebookEdit
class NotebookEdit {}
A notebook edit represents edits that should be applied to the contents of a notebook.
constructor
constructor(range: NotebookRange, newCells: NotebookCellData[]);
Create a new notebook edit.
Parameter range
A notebook range.
Parameter newCells
An array of new cell data.
property newCellMetadata
newCellMetadata?: { [key: string]: any };
Optional new metadata for the cells.
property newCells
newCells: NotebookCellData[];
New cells being inserted. May be empty.
property newNotebookMetadata
newNotebookMetadata?: { [key: string]: any };
Optional new metadata for the notebook.
property range
range: NotebookRange;
Range of the cells being edited. May be empty.
method deleteCells
static deleteCells: (range: NotebookRange) => NotebookEdit;
Utility to create an edit that deletes cells in a notebook.
Parameter range
The range of cells to delete.
method insertCells
static insertCells: ( index: number, newCells: NotebookCellData[]) => NotebookEdit;
Utility to create an edit that replaces cells in a notebook.
Parameter index
The index to insert cells at.
Parameter newCells
The new notebook cells.
method replaceCells
static replaceCells: ( range: NotebookRange, newCells: NotebookCellData[]) => NotebookEdit;
Utility to create a edit that replaces cells in a notebook.
Parameter range
The range of cells to replace
Parameter newCells
The new notebook cells.
method updateCellMetadata
static updateCellMetadata: ( index: number, newCellMetadata: { [key: string]: any }) => NotebookEdit;
Utility to create an edit that update a cell's metadata.
Parameter index
The index of the cell to update.
Parameter newCellMetadata
The new metadata for the cell.
method updateNotebookMetadata
static updateNotebookMetadata: (newNotebookMetadata: { [key: string]: any;}) => NotebookEdit;
Utility to create an edit that updates the notebook's metadata.
Parameter newNotebookMetadata
The new metadata for the notebook.
class NotebookRange
class NotebookRange {}
A notebook range represents an ordered pair of two cell indices. It is guaranteed that start is less than or equal to end.
constructor
constructor(start: number, end: number);
Create a new notebook range. If
start
is not before or equal toend
, the values will be swapped.Parameter start
start index
Parameter end
end index.
property end
readonly end: number;
The exclusive end index of this range (zero-based).
property isEmpty
readonly isEmpty: boolean;
true
ifstart
andend
are equal.
property start
readonly start: number;
The zero-based start index of this range.
method with
with: (change: { start?: number; end?: number }) => NotebookRange;
Derive a new range for this range.
Parameter change
An object that describes a change to this range.
Returns
A range that reflects the given change. Will return
this
range if the change is not changing anything.
class ParameterInformation
class ParameterInformation {}
Represents a parameter of a callable-signature. A parameter can have a label and a doc-comment.
constructor
constructor( label: string | [number, number], documentation?: string | MarkdownString);
Creates a new parameter information object.
Parameter label
A label string or inclusive start and exclusive end offsets within its containing signature label.
Parameter documentation
A doc string.
property documentation
documentation?: string | MarkdownString;
The human-readable doc-comment of this signature. Will be shown in the UI but can be omitted.
property label
label: string | [number, number];
The label of this signature.
Either a string or inclusive start and exclusive end offsets within its containing . *Note*: A label of type string must be a substring of its containing signature information's .
class Position
class Position {}
Represents a line and character position, such as the position of the cursor.
Position objects are __immutable__. Use the or methods to derive new positions from an existing position.
constructor
constructor(line: number, character: number);
Parameter line
A zero-based line value.
Parameter character
A zero-based character value.
property character
readonly character: number;
The zero-based character value.
property line
readonly line: number;
The zero-based line value.
method compareTo
compareTo: (other: Position) => number;
Compare this to
other
.Parameter other
A position.
Returns
A number smaller than zero if this position is before the given position, a number greater than zero if this position is after the given position, or zero when this and the given position are equal.
method isAfter
isAfter: (other: Position) => boolean;
Check if this position is after
other
.Parameter other
A position.
Returns
true
if position is on a greater line or on the same line on a greater character.
method isAfterOrEqual
isAfterOrEqual: (other: Position) => boolean;
Check if this position is after or equal to
other
.Parameter other
A position.
Returns
true
if position is on a greater line or on the same line on a greater or equal character.
method isBefore
isBefore: (other: Position) => boolean;
Check if this position is before
other
.Parameter other
A position.
Returns
true
if position is on a smaller line or on the same line on a smaller character.
method isBeforeOrEqual
isBeforeOrEqual: (other: Position) => boolean;
Check if this position is before or equal to
other
.Parameter other
A position.
Returns
true
if position is on a smaller line or on the same line on a smaller or equal character.
method isEqual
isEqual: (other: Position) => boolean;
Check if this position is equal to
other
.Parameter other
A position.
Returns
true
if the line and character of the given position are equal to the line and character of this position.
method translate
translate: { (lineDelta?: number, characterDelta?: number): Position; (change: { lineDelta?: number; characterDelta?: number }): Position;};
Create a new position relative to this position.
Parameter lineDelta
Delta value for the line value, default is
0
.Parameter characterDelta
Delta value for the character value, default is
0
.Returns
A position which line and character is the sum of the current line and character and the corresponding deltas.
Derived a new position relative to this position.
Parameter change
An object that describes a delta to this position.
Returns
A position that reflects the given delta. Will return
this
position if the change is not changing anything.
method with
with: { (line?: number, character?: number): Position; (change: { line?: number; character?: number }): Position;};
Create a new position derived from this position.
Parameter line
Value that should be used as line value, default is the
Parameter character
Value that should be used as character value, default is the
Returns
A position where line and character are replaced by the given values.
Derived a new position from this position.
Parameter change
An object that describes a change to this position.
Returns
A position that reflects the given change. Will return
this
position if the change is not changing anything.
class ProcessExecution
class ProcessExecution {}
The execution of a task happens as an external process without shell interaction.
constructor
constructor(process: string, options?: ProcessExecutionOptions);
Creates a process execution.
Parameter process
The process to start.
Parameter options
Optional options for the started process.
constructor
constructor(process: string, args: string[], options?: ProcessExecutionOptions);
Creates a process execution.
Parameter process
The process to start.
Parameter args
Arguments to be passed to the process.
Parameter options
Optional options for the started process.
property args
args: string[];
The arguments passed to the process. Defaults to an empty array.
property options
options?: ProcessExecutionOptions;
The process options used when the process is executed. Defaults to undefined.
property process
process: string;
The process to be executed.
class QuickInputButtons
class QuickInputButtons {}
class Range
class Range {}
A range represents an ordered pair of two positions. It is guaranteed that .isBeforeOrEqual()
Range objects are __immutable__. Use the , , or methods to derive new ranges from an existing range.
constructor
constructor(start: Position, end: Position);
Create a new range from two positions. If
start
is not before or equal toend
, the values will be swapped.Parameter start
A position.
Parameter end
A position.
constructor
constructor( startLine: number, startCharacter: number, endLine: number, endCharacter: number);
Create a new range from number coordinates. It is a shorter equivalent of using
new Range(new Position(startLine, startCharacter), new Position(endLine, endCharacter))
Parameter startLine
A zero-based line value.
Parameter startCharacter
A zero-based character value.
Parameter endLine
A zero-based line value.
Parameter endCharacter
A zero-based character value.
property end
readonly end: Position;
The end position. It is after or equal to .
property isEmpty
isEmpty: boolean;
true
ifstart
andend
are equal.
property isSingleLine
isSingleLine: boolean;
true
ifstart.line
andend.line
are equal.
property start
readonly start: Position;
The start position. It is before or equal to .
method contains
contains: (positionOrRange: Position | Range) => boolean;
Check if a position or a range is contained in this range.
Parameter positionOrRange
A position or a range.
Returns
true
if the position or range is inside or equal to this range.
method intersection
intersection: (range: Range) => Range | undefined;
Intersect
range
with this range and returns a new range orundefined
if the ranges have no overlap.Parameter range
A range.
Returns
A range of the greater start and smaller end positions. Will return undefined when there is no overlap.
method isEqual
isEqual: (other: Range) => boolean;
Check if
other
equals this range.Parameter other
A range.
Returns
true
when start and end are to start and end of this range.
method union
union: (other: Range) => Range;
Compute the union of
other
with this range.Parameter other
A range.
Returns
A range of smaller start position and the greater end position.
method with
with: { (start?: Position, end?: Position): Range; (change: { start?: Position; end?: Position }): Range;};
Derived a new range from this range.
Parameter start
A position that should be used as start. The default value is the .
Parameter end
A position that should be used as end. The default value is the .
Returns
A range derived from this range with the given start and end position. If start and end are not different
this
range will be returned.Derived a new range from this range.
Parameter change
An object that describes a change to this range.
Returns
A range that reflects the given change. Will return
this
range if the change is not changing anything.
class RelativePattern
class RelativePattern {}
A relative pattern is a helper to construct glob patterns that are matched relatively to a base file path. The base path can either be an absolute file path as string or uri or a , which is the preferred way of creating the relative pattern.
constructor
constructor(base: string | Uri | WorkspaceFolder, pattern: string);
Creates a new relative pattern object with a base file path and pattern to match. This pattern will be matched on file paths relative to the base.
Example:
const folder = vscode.workspace.workspaceFolders?.[0];if (folder) {// Match any TypeScript file in the root of this workspace folderconst pattern1 = new vscode.RelativePattern(folder, '*.ts');// Match any TypeScript file in `someFolder` inside this workspace folderconst pattern2 = new vscode.RelativePattern(folder, 'someFolder/*.ts');}Parameter base
A base to which this pattern will be matched against relatively. It is recommended to pass in a if the pattern should match inside the workspace. Otherwise, a uri or string should only be used if the pattern is for a file path outside the workspace.
Parameter pattern
A file glob pattern like
*.{ts,js}
that will be matched on paths relative to the base.
property base
base: string;
A base file path to which this pattern will be matched against relatively.
This matches the
fsPath
value of RelativePattern.baseUri.*Note:* updating this value will update RelativePattern.baseUri to be a uri with
file
scheme.Deprecated
This property is deprecated, please use RelativePattern.baseUri instead.
property baseUri
baseUri: Uri;
A base file path to which this pattern will be matched against relatively. The file path must be absolute, should not have any trailing path separators and not include any relative segments (
.
or..
).
property pattern
pattern: string;
A file glob pattern like
*.{ts,js}
that will be matched on file paths relative to the base path.Example: Given a base of
/home/work/folder
and a file path of/home/work/folder/index.js
, the file glob pattern will match onindex.js
.
class Selection
class Selection extends Range {}
Represents a text selection in an editor.
constructor
constructor(anchor: Position, active: Position);
Create a selection from two positions.
Parameter anchor
A position.
Parameter active
A position.
constructor
constructor( anchorLine: number, anchorCharacter: number, activeLine: number, activeCharacter: number);
Create a selection from four coordinates.
Parameter anchorLine
A zero-based line value.
Parameter anchorCharacter
A zero-based character value.
Parameter activeLine
A zero-based line value.
Parameter activeCharacter
A zero-based character value.
property active
active: Position;
The position of the cursor. This position might be before or after .
property anchor
anchor: Position;
The position at which the selection starts. This position might be before or after .
property isReversed
isReversed: boolean;
A selection is reversed if its is the position.
class SelectionRange
class SelectionRange {}
A selection range represents a part of a selection hierarchy. A selection range may have a parent selection range that contains it.
constructor
constructor(range: Range, parent?: SelectionRange);
Creates a new selection range.
Parameter range
The range of the selection range.
Parameter parent
The parent of the selection range.
property parent
parent?: SelectionRange;
The parent selection range containing this range.
property range
range: Range;
The Range of this selection range.
class SemanticTokens
class SemanticTokens {}
Represents semantic tokens, either in a range or in an entire document.
See Also
for an explanation of the format.
SemanticTokensBuilder for a helper to create an instance.
constructor
constructor(data: Uint32Array, resultId?: string);
Create new semantic tokens.
Parameter data
Token data.
Parameter resultId
Result identifier.
property data
readonly data: Uint32Array;
The actual tokens data.
See Also
for an explanation of the format.
property resultId
readonly resultId: string;
The result id of the tokens.
This is the id that will be passed to
DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits
(if implemented).
class SemanticTokensBuilder
class SemanticTokensBuilder {}
A semantic tokens builder can help with creating a
SemanticTokens
instance which contains delta encoded semantic tokens.
constructor
constructor(legend?: SemanticTokensLegend);
Creates a semantic tokens builder.
Parameter legend
A semantic tokens legent.
method build
build: (resultId?: string) => SemanticTokens;
Finish and create a
SemanticTokens
instance.
method push
push: { ( line: number, char: number, length: number, tokenType: number, tokenModifiers?: number ): void; (range: Range, tokenType: string, tokenModifiers?: readonly string[]): void;};
Add another token.
Parameter line
The token start line number (absolute value).
Parameter char
The token start character (absolute value).
Parameter length
The token length in characters.
Parameter tokenType
The encoded token type.
Parameter tokenModifiers
The encoded token modifiers.
Add another token. Use only when providing a legend.
Parameter range
The range of the token. Must be single-line.
Parameter tokenType
The token type.
Parameter tokenModifiers
The token modifiers.
class SemanticTokensEdit
class SemanticTokensEdit {}
Represents an edit to semantic tokens.
See Also
for an explanation of the format.
constructor
constructor(start: number, deleteCount: number, data?: Uint32Array);
Create a semantic token edit.
Parameter start
Start offset
Parameter deleteCount
Number of elements to remove.
Parameter data
Elements to insert
property data
readonly data: Uint32Array;
The elements to insert.
property deleteCount
readonly deleteCount: number;
The count of elements to remove.
property start
readonly start: number;
The start offset of the edit.
class SemanticTokensEdits
class SemanticTokensEdits {}
Represents edits to semantic tokens.
See Also
for an explanation of the format.
constructor
constructor(edits: SemanticTokensEdit[], resultId?: string);
Create new semantic tokens edits.
Parameter edits
An array of semantic token edits
Parameter resultId
Result identifier.
property edits
readonly edits: SemanticTokensEdit[];
The edits to the tokens data. All edits refer to the initial data state.
property resultId
readonly resultId: string;
The result id of the tokens.
This is the id that will be passed to
DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits
(if implemented).
class SemanticTokensLegend
class SemanticTokensLegend {}
A semantic tokens legend contains the needed information to decipher the integer encoded representation of semantic tokens.
constructor
constructor(tokenTypes: string[], tokenModifiers?: string[]);
Creates a semantic tokens legend.
Parameter tokenTypes
An array of token types.
Parameter tokenModifiers
An array of token modifiers.
property tokenModifiers
readonly tokenModifiers: string[];
The possible token modifiers.
property tokenTypes
readonly tokenTypes: string[];
The possible token types.
class ShellExecution
class ShellExecution {}
Represents a task execution that happens inside a shell.
constructor
constructor(commandLine: string, options?: ShellExecutionOptions);
Creates a shell execution with a full command line.
Parameter commandLine
The command line to execute.
Parameter options
Optional options for the started the shell.
constructor
constructor( command: string | ShellQuotedString, args: (string | ShellQuotedString)[], options?: ShellExecutionOptions);
Creates a shell execution with a command and arguments. For the real execution the editor will construct a command line from the command and the arguments. This is subject to interpretation especially when it comes to quoting. If full control over the command line is needed please use the constructor that creates a
ShellExecution
with the full command line.Parameter command
The command to execute.
Parameter args
The command arguments.
Parameter options
Optional options for the started the shell.
property args
args: (string | ShellQuotedString)[];
The shell args. Is
undefined
if created with a full command line.
property command
command: string | ShellQuotedString;
The shell command. Is
undefined
if created with a full command line.
property commandLine
commandLine: string;
The shell command line. Is
undefined
if created with a command and arguments.
property options
options?: ShellExecutionOptions;
The shell options used when the command line is executed in a shell. Defaults to undefined.
class SignatureHelp
class SignatureHelp {}
Signature help represents the signature of something callable. There can be multiple signatures but only one active and only one active parameter.
property activeParameter
activeParameter: number;
The active parameter of the active signature.
property activeSignature
activeSignature: number;
The active signature.
property signatures
signatures: SignatureInformation[];
One or more signatures.
class SignatureInformation
class SignatureInformation {}
Represents the signature of something callable. A signature can have a label, like a function-name, a doc-comment, and a set of parameters.
constructor
constructor(label: string, documentation?: string | MarkdownString);
Creates a new signature information object.
Parameter label
A label string.
Parameter documentation
A doc string.
property activeParameter
activeParameter?: number;
The index of the active parameter.
If provided, this is used in place of .
property documentation
documentation?: string | MarkdownString;
The human-readable doc-comment of this signature. Will be shown in the UI but can be omitted.
property label
label: string;
The label of this signature. Will be shown in the UI.
property parameters
parameters: ParameterInformation[];
The parameters of this signature.
class SnippetString
class SnippetString {}
A snippet string is a template which allows to insert text and to control the editor cursor when insertion happens.
A snippet can define tab stops and placeholders with
$1
,$2
and${3:foo}
.$0
defines the final tab stop, it defaults to the end of the snippet. Variables are defined with$name
and${name:default value}
. Also see [the full snippet syntax](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets).
constructor
constructor(value?: string);
Create a new snippet string.
Parameter value
A snippet string.
property value
value: string;
The snippet string.
method appendChoice
appendChoice: (values: readonly string[], number?: number) => SnippetString;
Builder-function that appends a choice (
${1|a,b,c|}
) to the of this snippet string.Parameter values
The values for choices - the array of strings
Parameter number
The number of this tabstop, defaults to an auto-increment value starting at 1.
Returns
This snippet string.
method appendPlaceholder
appendPlaceholder: ( value: string | ((snippet: SnippetString) => any), number?: number) => SnippetString;
Builder-function that appends a placeholder (
${1:value}
) to the of this snippet string.Parameter value
The value of this placeholder - either a string or a function with which a nested snippet can be created.
Parameter number
The number of this tabstop, defaults to an auto-increment value starting at 1.
Returns
This snippet string.
method appendTabstop
appendTabstop: (number?: number) => SnippetString;
Builder-function that appends a tabstop (
$1
,$2
etc) to the of this snippet string.Parameter number
The number of this tabstop, defaults to an auto-increment value starting at 1.
Returns
This snippet string.
method appendText
appendText: (string: string) => SnippetString;
Builder-function that appends the given string to the of this snippet string.
Parameter string
A value to append 'as given'. The string will be escaped.
Returns
This snippet string.
method appendVariable
appendVariable: ( name: string, defaultValue: string | ((snippet: SnippetString) => any)) => SnippetString;
Builder-function that appends a variable (
${VAR}
) to the of this snippet string.Parameter name
The name of the variable - excluding the
$
.Parameter defaultValue
The default value which is used when the variable name cannot be resolved - either a string or a function with which a nested snippet can be created.
Returns
This snippet string.
class SnippetTextEdit
class SnippetTextEdit {}
A snippet edit represents an interactive edit that is performed by the editor.
*Note* that a snippet edit can always be performed as a normal . This will happen when no matching editor is open or when a contains snippet edits for multiple files. In that case only those that match the active editor will be performed as snippet edits and the others as normal text edits.
constructor
constructor(range: Range, snippet: SnippetString);
Create a new snippet edit.
Parameter range
A range.
Parameter snippet
A snippet string.
property range
range: Range;
The range this edit applies to.
property snippet
snippet: SnippetString;
The this edit will perform.
method insert
static insert: (position: Position, snippet: SnippetString) => SnippetTextEdit;
Utility to create an insert snippet edit.
Parameter position
A position, will become an empty range.
Parameter snippet
A snippet string.
Returns
A new snippet edit object.
method replace
static replace: (range: Range, snippet: SnippetString) => SnippetTextEdit;
Utility to create a replace snippet edit.
Parameter range
A range.
Parameter snippet
A snippet string.
Returns
A new snippet edit object.
class SourceBreakpoint
class SourceBreakpoint extends Breakpoint {}
A breakpoint specified by a source location.
constructor
constructor( location: Location, enabled?: boolean, condition?: string, hitCondition?: string, logMessage?: string);
Create a new breakpoint for a source location.
property location
readonly location: Location;
The source and line position of this breakpoint.
class StatementCoverage
class StatementCoverage {}
Contains coverage information for a single statement or line.
constructor
constructor( executed: number | boolean, location: Range | Position, branches?: BranchCoverage[]);
Parameter location
The statement position.
Parameter executed
The number of times this statement was executed, or a boolean indicating whether it was executed if the exact count is unknown. If zero or false, the statement will be marked as un-covered.
Parameter branches
Coverage from branches of this line. If it's not a conditional, this should be omitted.
property branches
branches: BranchCoverage[];
Coverage from branches of this line or statement. If it's not a conditional, this will be empty.
property executed
executed: number | boolean;
The number of times this statement was executed, or a boolean indicating whether it was executed if the exact count is unknown. If zero or false, the statement will be marked as un-covered.
property location
location: Range | Position;
Statement location.
class SymbolInformation
class SymbolInformation {}
Represents information about programming constructs like variables, classes, interfaces etc.
constructor
constructor( name: string, kind: SymbolKind, containerName: string, location: Location);
Creates a new symbol information object.
Parameter name
The name of the symbol.
Parameter kind
The kind of the symbol.
Parameter containerName
The name of the symbol containing the symbol.
Parameter location
The location of the symbol.
constructor
constructor( name: string, kind: SymbolKind, range: Range, uri?: Uri, containerName?: string);
Creates a new symbol information object.
Parameter name
The name of the symbol.
Parameter kind
The kind of the symbol.
Parameter range
The range of the location of the symbol.
Parameter uri
The resource of the location of symbol, defaults to the current document.
Parameter containerName
The name of the symbol containing the symbol.
Deprecated
Please use the constructor taking a Location object.
property containerName
containerName: string;
The name of the symbol containing this symbol.
property kind
kind: SymbolKind;
The kind of this symbol.
property location
location: Location;
The location of this symbol.
property name
name: string;
The name of this symbol.
property tags
tags?: readonly SymbolTag[];
Tags for this symbol.
class TabInputCustom
class TabInputCustom {}
The tab represents a custom editor.
constructor
constructor(uri: Uri, viewType: string);
Constructs a custom editor tab input.
Parameter uri
The uri of the tab.
Parameter viewType
The viewtype of the custom editor.
property uri
readonly uri: Uri;
The uri that the tab is representing.
property viewType
readonly viewType: string;
The type of custom editor.
class TabInputNotebook
class TabInputNotebook {}
The tab represents a notebook.
constructor
constructor(uri: Uri, notebookType: string);
Constructs a new tab input for a notebook.
Parameter uri
The uri of the notebook.
Parameter notebookType
The type of notebook. Maps to
property notebookType
readonly notebookType: string;
The type of notebook. Maps to
property uri
readonly uri: Uri;
The uri that the tab is representing.
class TabInputNotebookDiff
class TabInputNotebookDiff {}
The tabs represents two notebooks in a diff configuration.
constructor
constructor(original: Uri, modified: Uri, notebookType: string);
Constructs a notebook diff tab input.
Parameter original
The uri of the original unmodified notebook.
Parameter modified
The uri of the modified notebook.
Parameter notebookType
The type of notebook. Maps to
property modified
readonly modified: Uri;
The uri of the modified notebook.
property notebookType
readonly notebookType: string;
The type of notebook. Maps to
property original
readonly original: Uri;
The uri of the original notebook.
class TabInputTerminal
class TabInputTerminal {}
The tab represents a terminal in the editor area.
constructor
constructor();
Constructs a terminal tab input.
class TabInputText
class TabInputText {}
The tab represents a single text based resource.
constructor
constructor(uri: Uri);
Constructs a text tab input with the given URI.
Parameter uri
The URI of the tab.
property uri
readonly uri: Uri;
The uri represented by the tab.
class TabInputTextDiff
class TabInputTextDiff {}
The tab represents two text based resources being rendered as a diff.
constructor
constructor(original: Uri, modified: Uri);
Constructs a new text diff tab input with the given URIs.
Parameter original
The uri of the original text resource.
Parameter modified
The uri of the modified text resource.
property modified
readonly modified: Uri;
The uri of the modified text resource.
property original
readonly original: Uri;
The uri of the original text resource.
class TabInputWebview
class TabInputWebview {}
The tab represents a webview.
constructor
constructor(viewType: string);
Constructs a webview tab input with the given view type.
Parameter viewType
The type of webview. Maps to
property viewType
readonly viewType: string;
The type of webview. Maps to
class Task
class Task {}
A task to execute
constructor
constructor( taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]);
Creates a new task.
Parameter taskDefinition
The task definition as defined in the taskDefinitions extension point.
Parameter scope
Specifies the task's scope. It is either a global or a workspace task or a task for a specific workspace folder. Global tasks are currently not supported.
Parameter name
The task's name. Is presented in the user interface.
Parameter source
The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface.
Parameter execution
The process or shell execution.
Parameter problemMatchers
the names of problem matchers to use, like '$tsc' or '$eslint'. Problem matchers can be contributed by an extension using the
problemMatchers
extension point.
constructor
constructor( taskDefinition: TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
Creates a new task.
Parameter taskDefinition
The task definition as defined in the taskDefinitions extension point.
Parameter name
The task's name. Is presented in the user interface.
Parameter source
The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface.
Parameter execution
The process or shell execution.
Parameter problemMatchers
the names of problem matchers to use, like '$tsc' or '$eslint'. Problem matchers can be contributed by an extension using the
problemMatchers
extension point.Deprecated
Use the new constructors that allow specifying a scope for the task.
property definition
definition: TaskDefinition;
The task's definition.
property detail
detail?: string;
A human-readable string which is rendered less prominently on a separate line in places where the task's name is displayed. Supports rendering of via the
$(<name>)
-syntax.
property execution
execution?: ProcessExecution | ShellExecution | CustomExecution;
The task's execution engine
property group
group?: TaskGroup;
The task group this tasks belongs to. See TaskGroup for a predefined set of available groups. Defaults to undefined meaning that the task doesn't belong to any special group.
property isBackground
isBackground: boolean;
Whether the task is a background task or not.
property name
name: string;
The task's name
property presentationOptions
presentationOptions: TaskPresentationOptions;
The presentation options. Defaults to an empty literal.
property problemMatchers
problemMatchers: string[];
The problem matchers attached to the task. Defaults to an empty array.
property runOptions
runOptions: RunOptions;
Run options for the task
property scope
readonly scope: WorkspaceFolder | TaskScope;
The task's scope.
property source
source: string;
A human-readable string describing the source of this shell task, e.g. 'gulp' or 'npm'. Supports rendering of via the
$(<name>)
-syntax.
class TaskGroup
class TaskGroup {}
A grouping for tasks. The editor by default supports the 'Clean', 'Build', 'RebuildAll' and 'Test' group.
property Build
static Build: TaskGroup;
The build task group;
property Clean
static Clean: TaskGroup;
The clean task group;
property id
readonly id: string;
The ID of the task group. Is one of TaskGroup.Clean.id, TaskGroup.Build.id, TaskGroup.Rebuild.id, or TaskGroup.Test.id.
property isDefault
readonly isDefault: boolean;
Whether the task that is part of this group is the default for the group. This property cannot be set through API, and is controlled by a user's task configurations.