Muistiinpano
Tämän sivun käyttö edellyttää valtuutusta. Voit yrittää kirjautua sisään tai vaihtaa hakemistoa.
Tämän sivun käyttö edellyttää valtuutusta. Voit yrittää vaihtaa hakemistoa.
The new Visual Studio extensibility model is entirely in a separate process, and communication between the extension process and the Visual Studio process occurs through a stream. As a result, all APIs have to operate at some level with serializable data types. Typically, extensions can ignore these implementation details. In some scenarios, an extension might need to interface directly with remote procedure call (RPC) services acquired from this.Extensibility.ServiceBroker.
Serializable RPC types
To facilitate interactions with RPC services, the object model exposes RpcContract properties on most core types, and the following serializable RPC types:
VersionedTextDocumentRange: 1:1 serializable version ofSpan, which you can access through theRpcContractproperty. Use this type in most RPC contracts between processes.VersionedTextDocumentPosition: 1:1 serializable version ofPosition, which you can access through theRpcContractproperty. Use this type in most RPC contracts between processes.Range: Serializable version of Span, which omits the URI and version number.Microsoft.VisualStudio.RpcContracts.Utilities.Position: Serializable version ofPosition, which omits the URI and version number.TextView: 1:1 serialized form ofITextView, which you can access through theRpcContractproperty.TextDocument: 1:1 serialized form ofITextDocumentthrough theRpcContractproperty.
As opposed to VersionedTextDocumentRange and VersionedTextDocumentPosition, Range and Microsoft.VisualStudio.RpcContracts.Utilities.Position omit the URI and document version, which makes for a smaller serializable representation. Use this type in RPC contracts that contain lots of span or range equivalents that need to reduce their payload size for performance. These RPC contracts need to pass the document URI and version for the spans or range to be instantiated into Span and Position objects by IEditorHostService. The IEditorHostService interfaces with extension-local copies of the text buffer and manages the opening and closing of documents described by the RPC types.
Related content
- To learn more about Remote UI, the RPC model used in
VisualStudio.Extensibility, see Remote UI.