共用方式為


Language Service Essentials

To integrate a programming language into Visual Studio, you must provide a language service. You can develop the service in either managed or native code.

Visual Studio uses language services to provide the following features:

Feature

Description

Syntax coloring

Causes the editor view to display different colors and font styles for the different elements of a language. This differentiation can make it easier to read and edit files.

For general information, see Syntax Coloring.

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

Statement completion

Completes a statement or keyword that the 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 information about this feature in the MPF, see IntelliSense Complete Word (Managed Package Framework).

Brace matching

Highlights paired characters such as braces. When the 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

Displays a list of possible signatures for the overloaded method that the user is currently typing.

For general information, see Parameter Info Tooltips.

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

Error markers

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

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

Many of these features require the language service to parse source code. You often can reuse the tokenizing and parsing code for your compiler or interpreter.

The following features are related to support for programming languages but are not part of language services:

Feature

Description

Expression evaluators

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 Language Service Support for Debugging.

Symbol-browsing tools

Supports Object Browser, Class View, Call Browser, and Find Symbol Results.