Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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)
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.


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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.