Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

IVsTextManager Interface

Provides general services for anyone wanting information about the active text views.

Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in microsoft.visualstudio.textmanager.interop.dll)

[GuidAttribute("909F83E3-B3FC-4BBF-8820-64378744B39B")] 
[InterfaceTypeAttribute(1)] 
public interface IVsTextManager
/** @attribute GuidAttribute("909F83E3-B3FC-4BBF-8820-64378744B39B") */ 
/** @attribute InterfaceTypeAttribute(1) */ 
public interface IVsTextManager
GuidAttribute("909F83E3-B3FC-4BBF-8820-64378744B39B") 
InterfaceTypeAttribute(1) 
public interface IVsTextManager

There is one text manager in the environment. The text manager manages all of the text buffers that are active at any given point, all of the user settings for the different languages, and any other global preferences related to the core text editor. When the user specifies preferences for the appearance and/or behavior of components in the text editor, the text manager stores this information and communicates it to all relevant clients. Examples include color preferences, tab versus space preferences, and so on. Preferences that are unique to a given language (that is, that apply to one language but to no other) are not stored here. These settings are managed by the individual language services.

The text manager provides a central location for components to discover common information, such as whether a buffer is under source-code control, registering for file-change notifications, keeping track of which views are associated with which buffers, and so on.

See illustrations of the implementation and/or calling of this interface in the sample Figures Edit Sample.

NoteNote

For historical reasons, VSPackages using the Managed Package Framework, use VsTextManagerClass (the class implementing IVsTextManager) with System.typeof, instead of IVsTextManager, to obtain the serviceType argument for GetService. The return value of GetService must then be cast to IVsTextManager. For more information see GetService.

An IVsTextManager interface can be obtained with:

IVsTextManager mytext_mgr = myPackage.GetService(System.typeof(VsTextManagerClass)) as IVsTextManager;

Notes to Implementers Implemented by the environment.

Notes to Callers Called by any component that needs to learn about the current view or other information related to the global preferences. The methods of IVsTextManager are most likely required by tools that interact with the Visual Studio core editor.

Community Additions

ADD
Show:
© 2015 Microsoft