Managed Language Services Technology Overview

By using Managed Language Services, you can integrate a programming language, especially a custom language that you have developed, into Visual Studio 2008. After you have integrated your language, you can use it just like the languages that are included with Visual Studio 2008.

Managed Language Services require the following:

  • Visual Studio 2008 SDK.

  • The Managed Package Framework (MPF), a C#-based framework.

  • A scanner to tokenize code written in your language and a parser to interpret the tokens to take advantage of Visual Studio 2008 language-service features.

When you use Managed Language Services, you can access the following features:

  • Syntax highlighting

  • Outlining

  • Commenting blocks of code

  • Brace matching

  • Code Snippets

  • Custom Document Properties

  • IntelliSense Parameter Info

  • IntelliSense Quick Info

  • IntelliSense Member Completion

  • IntelliSense Complete Word

Visual Studio 2005 SDK

Visual Studio 2008 SDK lets you write VSPackages in C# for your language service.

It also lets you start Visual Studio 2008 in an experimental hive so that you can experiment with your VSPackages without contaminating your production version of Visual Studio 2008.

The Managed Package Framework

You can use the MPF classes to create VSPackages by using managed code. The MPF provides default implementations for many VSPackage interfaces. Because the MPF already contains implementation details, it lets you create VSPackages with a minimum amount of additional code.

The following table lists the MPF namespaces provided by the Visual Studio 2008 SDK.

Name space

Contents

Microsoft.VisualStudio

Contains classes for handling COM errors, Visual Studio 2008 constants, and Win32 windows.

Microsoft.VisualStudio.Package

Includes managed code wrappers for Visual Studio 2008 projects, editors, and MSBuild.

Microsoft.VisualStudio.Package.Automation

Contains the wrappers for automation objects.

Microsoft.VisualStudio.Shell

Includes MPF base classes from which you can derive an implementation of many common Visual Studio 2008 objects. 

Microsoft.VisualStudio.Shell.Design

Contains Visual Studio 2008 designer extensions.

Microsoft.VisualStudio.Shell.Design.Serialization

Contains Visual Studio 2008 serialization designer extensions.

Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom

Contains Visual Studio 2008 CodeDom designer extensions.

Microsoft.VisualStudio.Shell.Flavor

Supports project subtypes (also known as "flavors").

The Scanner and Parser

The default scanner and parser expected by Visual Studio 2008 are Flex and Bison. When you create a new language service by using the Extensibility Wizard, it will ask you to specify their location. Flex and Bison are open-source tools and are freely downloadable from the Internet, but they are covered by the GPL. Under the GPL, if you modify Flex or Bison source code, you must publish your modifications.

Flex

Flex is a tool for generating scanners, which are programs that recognize lexical patterns in text. Flex reads the given input files, or standard input if no file names are given, for a description of a scanner to generate. The description is in the form of pairs of regular expressions called rules. Flex generates a source file output. When you run flex, it analyzes its input for occurrences of the regular expressions.

Bison

Bison parses input streams consisting of tokens with certain values. This clearly describes the relation bison has with flex, YACC has no idea what "input streams" are--it requires preprocessed tokens.

When bison was first created, it was used to parse input files for compilers that generated programs. Programs written in a programming language for computers are typically not ambiguous--they have just one meaning. As such, bison does not cope with ambiguity, so you must be sure to specify exactly the tokens that you expect bison to process.

See Also

Concepts

Managed Language Service Overview (Managed Package Framework)

Managed Package Framework Classes