Udostępnij za pośrednictwem


Language Services and the Core Editor

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Editors in Visual Studio are frequently associated with a language service. Among other things, a language service provides syntax coloring, statement completion, IntelliSense, and text formatting.

Core Editors and Document Data Objects

When you access the core editor, you do not create document data and document view objects. The IDE creates and controls these two objects, and you obtain handles to them by making the appropriate calls in your editor factory implementation.

For more information, see Determining Which Editor Opens a File in a Project.

Language Services and the Core Editor

By implementing a language service, you can control how data is displayed in the document view. A language service provides information and behavior that is specific to a given language, such as Visual C++. When you create a text buffer and determine the filename extension for the document you are opening, the text buffer determines the language service associated with this file name extension from a registry key, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Editors\{YourLanguageService GUID}\Extensions. The standard VSPackage loading procedure then loads your VSPackage and an instance of your language service is created.

A basic language service is shown in the following illustration.

Language Service Model graphic
Core editor and language service objects

The document data object for the core editor is called a text buffer and is represented by the VsTextBuffer object. The document view object is called a text view and is represented by the VsCodeWindow object. These two objects work together through the language service to provide a unified view of the core editor. Information from the text buffer and the text view displays in a document window called a code window. The code window document is managed by a code window manager.

See Also

IVsLanguageInfo
IVsColorizer
VsTextView
IVsCodeWindowManager
VsCodeWindow
Providing a Language Service Context by Using the Legacy API
IntelliSense Hosting
Contained Languages
Developing a Legacy Language Service