- AppliesToAttribute
- AppliesToPatternAttribute
- DocumentTypeBaseDefinitionAttribute
- DocumentTypeDefinitionAttribute
- EditBatch
- EditResponse
- EditorExtensibility
- FileExtensionMappingAttribute
- ITextViewChangedListener
- ITextViewChangedListenerContract
- ITextViewLifetimeListener
- ITextViewLifetimeListenerContract
- TextDocumentSnapshotEditResponse
- TextEdit
- TextViewChange
- TextViewChangedArgs
- TextViewChangedListener
- TextViewEditResponse
- TextViewLifetimeListener
- VisualStudioExtensibilityExtensions
Microsoft.VisualStudio.Extensibility.Editor
Describes the conditions under which an extension part should be activated.
The document type of an object. Document type is frequently used to target specific languages.
Microsoft.VisualStudio.Extensibility.Editor
Describes the conditions under which an extension part should be activated.
The glob pattern to match document file path. Glob patterns can have the following syntax:
- to match one or more characters in a path segment ? to match on one character in a path segment ** to match any number of path segments, including none {} to group conditions (e.g. **/*.{ts,js} matches all TypeScript and JavaScript files) [] to declare a range of characters to match in a path segment (e.g., example.[0-9] to match on example.0, example.1, …) [!...] to negate a range of characters to match in a path segment (e.g., example.[!0-9] to match on example.a, example.b, but not example.0) Note: a backslash () is not valid within a glob pattern. If you have an existing file path to match against, consider to use the relative pattern support that takes care of converting any backslash into slash. Otherwise, make sure to convert any backslash to slash when creating the glob pattern.
Defines whether the pattern should be applied to the absolute path of a file or to a path relative to the solution folder.
Microsoft.VisualStudio.Extensibility.Editor
Makes a document type inheriting from a defined base.
Example:
[assembly: DocumentTypeDefinitionAttribute("markdown")]
[assembly: DocumentTypeBaseDefinitionAttribute("markdown", baseDocumentTypeName: "code")]
[assembly: FileExtensionMappingAttribute("markdown", fileExtension: ".md")]
[assembly: FileExtensionMappingAttribute("markdown", fileExtension: ".mdk")]
[assembly: FileExtensionMappingAttribute("markdown", fileExtension: ".markdn")]
- Microsoft.VisualStudio.Extensibility.Editor.DocumentTypeDefinitionAttribute
- Microsoft.VisualStudio.Extensibility.Editor.FileExtensionMappingAttribute
- Microsoft.VisualStudio.Extensibility.Editor.AppliesToAttribute
Initializes a new instance of DocumentTypeBaseDefinitionAttribute.
Name | Type | Description |
---|---|---|
documentTypeName | System.String | The document type name. Document type names are case-insensitive. |
baseDocumentTypeName | System.String | The base document type name. Document type names are case-insensitive. |
Name | Description |
---|---|
System.ArgumentNullException | documentTypeName or baseDocumentTypeName is null or an empty string. |
The base document type name.
The document type name.
Microsoft.VisualStudio.Extensibility.Editor
Declares a new document type.
Example:
[assembly: DocumentTypeDefinitionAttribute("markdown")]
[assembly: DocumentTypeBaseDefinitionAttribute("markdown", baseDocumentTypeName: "code")]
[assembly: FileExtensionMappingAttribute("markdown", fileExtension: ".md")]
[assembly: FileExtensionMappingAttribute("markdown", fileExtension: ".mdk")]
[assembly: FileExtensionMappingAttribute("markdown", fileExtension: ".markdn")]
- Microsoft.VisualStudio.Extensibility.Editor.DocumentTypeBaseDefinitionAttribute
- Microsoft.VisualStudio.Extensibility.Editor.FileExtensionMappingAttribute
- Microsoft.VisualStudio.Extensibility.Editor.AppliesToAttribute
Initializes a new instance of DocumentTypeDefinitionAttribute.
Name | Type | Description |
---|---|---|
name | System.String | The document type name. Document type names are case-insensitive. |
Name | Description |
---|---|
System.ArgumentNullException | name is null or an empty string. |
The document type name.
Microsoft.VisualStudio.Extensibility.Editor.Editing
Builder for CompoundEditContract, describing a set of state changes that should be made by the process owning the entities to be changed, on behalf of the extension.
Microsoft.VisualStudio.Extensibility.Editor.Editing
Describes the cumulative result of a call to EditAsync.
Initializes a new instance of EditResponse.
Name | Type | Description |
---|---|---|
succeeded | System.Boolean | true if the cumulative operation completed successfully. |
message | System.String | Any cumulative error message, null , or Empty if none. |
documentEditResults | System.Collections.Generic.IReadOnlyDictionary{Microsoft.VisualStudio.Extensibility.Editor.Data.ITextDocumentSnapshot,Microsoft.VisualStudio.Extensibility.Editor.Editing.TextDocumentSnapshotEditResponse} | |
textViewEditResults | System.Collections.Generic.IReadOnlyDictionary{Microsoft.VisualStudio.Extensibility.Editor.UI.ITextViewSnapshot,Microsoft.VisualStudio.Extensibility.Editor.Editing.TextViewEditResponse} | Per-document operation results including per document errors and updated ITextDocumentSnapshot |
versions. |
Per-document operation results including per document errors and updated ITextDocumentSnapshot versions.
Key of dictionary is the version of the document prior to the edits. After contains the updated document version.
Any cumulative error message, null
, or Empty if none.
true
if the cumulative operation completed successfully.
Per text view operation results including per text view errors and updated ITextViewSnapshot versions.
Microsoft.VisualStudio.Extensibility.Editor
Framework object exposing methods for getting and interacting with ITextViewSnapshots and ITextDocumentSnapshots and performing document edits and other state changes.
You can get an instance of EditorExtensibility by calling Editor within an ExtensionPart or Command.
Initializes a new instance of EditorExtensibility.
Name | Type | Description |
---|---|---|
extensibility | Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility | The root extensibility object. |
editorHostService | Microsoft.VisualStudio.Extensibility.Editor.IEditorHostService | The editor host service. |
Initiates an edit request in the host Visual Studio process, enabling the extension to atomically request one or more ITextDocumentSnapshot edits, caret position changes, or other state changes.
A response object detailing whether the operation was successful and which ITextDocumentSnapshots and ITextViewSnapshots changed.
Name | Type | Description |
---|---|---|
editorSource | System.Action{Microsoft.VisualStudio.Extensibility.Editor.Editing.IEditBatch} | A service for obtaining editors for requesting changes to a IEditable`1 object, such as ITextDocumentSnapshot. |
cancellationToken | System.Threading.CancellationToken | Cancels a pending request. |
Edit request is sent to Visual Studio IDE, where it succeeds only if the object being edited hasn't changed since the version the request was made one. If the document has changed, the change may be rejected, requiring the extension to retry on a newer version.
Edits are applied atomically. The best practice is to do all changes that should occur within a narrow time frame within a single EditAsync() call to reduce the likelihood of unexpected behavior arising from user edits, or language service actions that occur between edits.
Gets the currently focused ITextViewSnapshot in the host Visual Studio process.
An instance of ITextViewSnapshot or null
.
Name | Type | Description |
---|---|---|
clientContext | Microsoft.VisualStudio.Extensibility.Definitions.IClientContext | The client context, usually passed to command handlers. |
cancellationToken | System.Threading.CancellationToken | Cancels the request. |
Can return null
if the clientContext
references a version of text view
that is sufficiently old so as to no longer be cached.
Microsoft.VisualStudio.Extensibility.Editor
Associate a document type to a file extension.
Example:
[assembly: DocumentTypeDefinitionAttribute("markdown")]
[assembly: DocumentTypeBaseDefinitionAttribute("markdown", baseDocumentTypeName: "code")]
[assembly: FileExtensionMappingAttribute("markdown", fileExtension: ".md")]
[assembly: FileExtensionMappingAttribute("markdown", fileExtension: ".mdk")]
[assembly: FileExtensionMappingAttribute("markdown", fileExtension: ".markdn")]
- Microsoft.VisualStudio.Extensibility.Editor.DocumentTypeDefinitionAttribute
- Microsoft.VisualStudio.Extensibility.Editor.DocumentTypeBaseDefinitionAttribute
- Microsoft.VisualStudio.Extensibility.Editor.AppliesToAttribute
Initializes a new instance of FileExtensionMappingAttribute.
Name | Type | Description |
---|---|---|
fileExtension | System.String | The file extension. File extensions are case-insensitive. |
documentType | System.String | The document type name. Document type names are case-insensitive. |
Name | Description |
---|---|
System.ArgumentNullException | fileExtension or documentType is null or an empty string. |
The document type name.
The file extension.
Microsoft.VisualStudio.Extensibility.Editor.UI
Extensibility point for listening for ITextViewSnapshots to be changed.
Called when an ITextViewSnapshot with matching document type is changed.
This method has no parameters.
Microsoft.VisualStudio.RpcContracts.Editor
RPC contract for a listener that is notified when text views are changed.
Called when an ITextViewSnapshot with matching document type is changed.
This method has no parameters.
Microsoft.VisualStudio.Extensibility.Editor.UI
Extensibility point for listening for ITextViewSnapshots to be opened and closed.
Called when an ITextViewSnapshot with matching document type is closed.
This method has no parameters.
Special scenarios:
- Document type changes from a matching document type to an unmatching, such as when the user changes the file extension, are considered 'text view closes' for the purposes of this API.
Called when an ITextViewSnapshot with matching document type is opened.
This method has no parameters.
Special scenarios:
- Document type changes from an unmatching document type to a matching, such as when the user changes the file extension, are considered 'text view creations' for the purposes of this API.
- This API will be called for all already open text views when an extension is hot loaded in the middle of an existing session.
Microsoft.VisualStudio.RpcContracts.Editor
RPC contract for a listener that is notified when text views are opened and closed.
Called when an ITextViewSnapshot with matching document type is closed.
This method has no parameters.
Special scenarios:
- Document type changes from a matching document type to an unmatching, such as when the user changes the file extension, are considered 'text view closes' for the purposes of this API.
Called when an ITextViewSnapshot with matching document type is opened.
This method has no parameters.
Special scenarios:
- Document type changes from an unmatching document type to a matching, such as when the user changes the file extension, are considered 'text view creations' for the purposes of this API.
- This API will be called for all already open text views when an extension is hot loaded in the middle of an existing session.
Microsoft.VisualStudio.Extensibility.Editor.Editing
Describes the outcome of a call to EditAsync for changes to a particular ITextDocumentSnapshot in the host Visual Studio process.
Initializes a new instance of TextDocumentSnapshotEditResponse.
Name | Type | Description |
---|---|---|
after | Microsoft.VisualStudio.Extensibility.Editor.Data.ITextDocumentSnapshot | The ITextDocumentSnapshot version after the changes were applied. |
editResult | Microsoft.VisualStudio.RpcContracts.Editor.EditResult | The result of the edit operation. |
The ITextDocumentSnapshot version after the changes were applied.
The result of the edit operation. Success if all changes were applied successfully to the target ITextDocumentSnapshot.
Microsoft.VisualStudio.Extensibility.Editor.Editing
A list of changes applied to a ITextDocumentSnapshot.
The range to replace. Can be zero length.
The new text to insert.
Microsoft.VisualStudio.RpcContracts.Editor
RPC contract representing a TextViewChangedArgs.
The state of the ITextViewSnapshot after the change.
The state of the ITextViewSnapshot before the change.
The set of edits made to the document during this change.
Microsoft.VisualStudio.Extensibility.Editor.UI
Arguments for ITextViewChangedListener.
Creates a new instance of TextViewChangedArgs.
Name | Type | Description |
---|---|---|
beforeTextView | Microsoft.VisualStudio.Extensibility.Editor.UI.ITextViewSnapshot | The state of the ITextViewSnapshot before the change. |
afterTextView | Microsoft.VisualStudio.Extensibility.Editor.UI.ITextViewSnapshot | The state of the ITextViewSnapshot after. |
edits | System.Collections.Generic.IReadOnlyList{Microsoft.VisualStudio.Extensibility.Editor.Editing.TextEdit} | A list of changes applied to the text document. |
The state of the ITextViewSnapshot after the change.
The state of the ITextViewSnapshot before the change.
A list of changes applied to the text document.
Microsoft.VisualStudio.Extensibility.Editor.UI
Wrapper object that converts RPC types to C# types.
Microsoft.VisualStudio.Extensibility.Editor.Editing
Describes the outcome of a call to EditAsync for changes to a particular ITextViewSnapshot in the host Visual Studio process.
Initializes a new instance of TextViewEditResponse.
Name | Type | Description |
---|---|---|
after | Microsoft.VisualStudio.Extensibility.Editor.UI.ITextViewSnapshot | The ITextViewSnapshot version after the changes were applied. |
editResult | Microsoft.VisualStudio.RpcContracts.Editor.EditResult | The result of the edit operation. |
The ITextViewSnapshot version after the changes were applied.
The result of the edit operation. Success if all changes were applied successfully to the target ITextViewSnapshot.
Microsoft.VisualStudio.Extensibility.Editor.UI
Wrapper object that converts RPC types to C# types.
Microsoft.VisualStudio.Extensibility
Editor provided extension methods for acquiring VS extensibility points.
Gets an instance of the EditorExtensibility point.
Editor extensibility.
Name | Type | Description |
---|---|---|
extensibility | Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility | The root VisualStudioExtensibility instance. |