Share via


Language Service and the Core Editor

Editors in Visual Studio are frequently associated with a language service. Among other things, a language service provides colorization of keywords and syntax, statement completion, IntelliSense, and text formatting. Without a language service, these features are unavailable in the core editor. However, this might be preferred if you do not want them in your editor.

Core Editors and Document Data Objects

The core editor follows the same implementation as most other standard (file-based) editors. For example, the document data object is managed separately from the document view object of the data. However, for 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 displays in the document view object. A language service is an object that 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 IDE's 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.

Core editor and language service objects

Language Service Model graphic

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

Reference

IVsLanguageInfo

IVsColorizer

VsTextView

IVsCodeWindowManager

VsCodeWindow

Other Resources

Core Editor

Developing a Language Service