Compartir a través de


Language Services Essentials

To integrate a programming language into Visual Studio, you must provide a language service. Visual Studio uses language services to provide the following features:

Feature

Description

Syntax coloring

Also known as syntax highlighting, this feature lets an editor display different colors and font styles for the different kinds of elements of a programming language or data file. This differentiation can make it easier to read and edit files.

For general information, see Providing a Syntax Coloring Service.

For an example of this feature in an unmanaged Visual C++ project, see CFigColorizer in the Figures Sample collection.

For information about this feature in the managed package framework (MPF), see Syntax Highlighting (Managed Package Framework).

Statement completion

This feature finishes a statement or keyword that your user has started typing. Statement completion helps users enter difficult statements more easily, with less typing and fewer chances for error.

For general information, see Statement Completion.

For an example of this feature in an unmanaged Visual C++ project, see CFigStatementCompletion in the Figures Sample collection.

For information about this feature in the MPF, see Supporting IntelliSense Complete Word (Managed Package Framework).

Brace matching

This feature highlights paired enclosing characters such as braces. When your user types a closing character, such as "}", brace matching highlights the corresponding opening character, such as "{". When there are several levels of enclosing characters, this feature helps users confirm that the enclosing characters are paired correctly.

For information about this feature in the MPF, see Brace Matching (Managed Package Framework).

Parameter information tooltips

Also known as method tips, this feature displays a list of possible signatures for the overloaded method or function your user is currently typing.

For general information, see Parameter Info Tooltips.

For an example of this feature in a native-code Visual C++ project, see CFigMethodData in the Figures Sample collection.

For information about this feature in the MPF, see Supporting IntelliSense Parameter Info (Managed Package Framework).

Error markers

This feature creates a wavy red underline, also known as a squiggly, under text considered syntactically incorrect. Error markers usually are used to make users aware of misspelled keywords, unclosed parentheses, invalid characters, and similar errors.

For general information, see How to: Implement Error Markers.

For an example of this feature in a native-code Visual C++ project, see CFigBufferTaskProvider in the Figures Sample collection.

In the MPF classes, error markers are handled automatically in the AddError method of the AuthoringSink class.

Many of these features require a language service to parse source code according to the language's tokens and grammar. You often can reuse the tokenizing and parsing code for your language's compiler or interpreter; for example, see IronPython Language Service Sample.

You can implement a language service in either managed or native code.

The following features are related to support for programming languages but stand alone from language services:

Feature

Description

Expression evaluators

This feature supports the Visual Studio debugger by validating breakpoints and supplying a list of expressions to be displayed in the Autos debug window.

For more information, see Debugger and Language Overview.

Symbol-browsing tools

This feature supports Object Browser, Class View, Call Browser, and Find Symbol Results.

To learn more about integrating languages in Visual Studio, you might find the following books helpful:

  • Nilges, Edward. Build Your Own .NET Language and Compiler. Berkeley, CA: Apress, 2004.

  • Aho, Alfred, Ravi Sethi, and Jeffery Ullman. Compilers: Principles, Techniques and Tools. Boston, MA: Addison-Wesley, 1986.

See Also

Concepts

Language Services

Implementing a Language Service