ProvideLanguageServiceAttribute ProvideLanguageServiceAttribute ProvideLanguageServiceAttribute ProvideLanguageServiceAttribute ProvideLanguageServiceAttribute Class


Informs Visual Studio that a VSPackage provides a language service. Used with the managed package framework (MPF).

public ref class ProvideLanguageServiceAttribute sealed : Microsoft::VisualStudio::Shell::RegistrationAttribute
public ref class ProvideLanguageServiceAttribute sealed : Microsoft::VisualStudio::Shell::RegistrationAttribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed class ProvideLanguageServiceAttribute : Microsoft.VisualStudio.Shell.RegistrationAttribute
type ProvideLanguageServiceAttribute = class
    inherit RegistrationAttribute
Public NotInheritable Class ProvideLanguageServiceAttribute
Inherits RegistrationAttribute


This example shows how this user-defined attribute is used to register a language service that supports IntelliSense operations, brace matching, asynchronous (background) parsing, and custom colorable items.


Visual C# allows for a shorthand form of a user-defined attribute by dropping the "Attribute" part of the name. This shorthand form is used in this and all other examples throughout this class.

using Microsoft.VisualStudio.Shell;  
namespace MyLanguagePackage  
    internal class MyConstants  
        public const string languageName           = "MyLanguage";  
        public const int    languageNameResourceID = 106;  
        // Optional language service properties  
        CodeSense             = true,  // General IntelliSense support  
        RequestStockColors    = false, // Custom colorable items  
        EnableASyncCompletion = true,  // supports background parsing  
        MatchBraces           = true,  // Match braces on command  
        MatchBracesAtCaret    = true   // Match braces while typing  
    class MyLanguagePackage  


This user-defined attribute (which is specific to Visual C#) is used to provide information necessary to register a language service with Visual Studio. The values specified by this attribute are stored as metadata in the assembly. This metadata is later used by a program such as regpkg.exe (part of the VSIP SDK) to create the corresponding registry keys and entries that tell Visual Studio about the language service.

The registry entries affected by the ProvideLanguageServiceAttribute are found under the following registry key:

            Language Services\  
              [language name]\  
                (Default) = reg_sz: [Language Service GUID]  
                Package   = reg_sz: [Package GUID]  
                LangResID = reg_dword: [language name resource ID]  

Where [X.Y] is the version of Visual Studio, for example, 8.0Exp, and [language name] is the name of the language (as specified in the second parameter to the ProvideLanguageServiceAttribute class constructor).


Each property specifies the exact registry entry it affects so those entries are not shown in the above example. Those additional entries appear at the same level as the three entries shown.

The class constructor specifies the minimum required parameters. A user-defined attribute class also supports optional named parameters. These named parameters are specified in the constructor's parameter list after the required parameters. All of the properties on this class that support both get and set operators can be specified as a named parameter. The Example shows how named parameters are used.


Some of the named parameters are specific to the managed package framework (MPF) and these are noted in each property description.

The following user-defined attributes are used for language services:

Attribute Description
ProvideLanguageServiceAttribute Registers the language service with Visual Studio and specifies what features are supported.
ProvideLanguageExtensionAttribute Associates a file extension with the language service.
ProvideLanguageEditorOptionPageAttribute Specifies a property node or page for the Options dialog box specific to the language service.
ProvideLanguageCodeExpansionAttribute Specifies location information to support code snippets in the language service.
ProvideServiceAttribute Registers a language service as a Visual Studio service. All services supplied in managed code use this attribute.

Notes to Inheritors

This attribute class cannot be inherited from so there is nothing to implement.

Notes to Callers

This attribute class is typically applied to your primary VSPackage class, although it can appear on any class. This class should appear only once for each language service your VSPackage supports.


ProvideLanguageServiceAttribute(Object, String, Int32) ProvideLanguageServiceAttribute(Object, String, Int32) ProvideLanguageServiceAttribute(Object, String, Int32) ProvideLanguageServiceAttribute(Object, String, Int32) ProvideLanguageServiceAttribute(Object, String, Int32)

Initializes a new instance of the Shell.ProvideLanguageServiceAttribute class.


AutoOutlining AutoOutlining AutoOutlining AutoOutlining AutoOutlining

Determines if the language service supports automatic outlining.

CodeSense CodeSense CodeSense CodeSense CodeSense

Determines if the language service supports IntelliSense operations.

CodeSenseDelay CodeSenseDelay CodeSenseDelay CodeSenseDelay CodeSenseDelay

Determines the amount of time before a parse operation is started to support an IntelliSense operation.

DebuggerLanguageExpressionEvaluator DebuggerLanguageExpressionEvaluator DebuggerLanguageExpressionEvaluator DebuggerLanguageExpressionEvaluator DebuggerLanguageExpressionEvaluator

Determines the expression evaluator that is used for evaluating expressions.

DefaultToInsertSpaces DefaultToInsertSpaces DefaultToInsertSpaces DefaultToInsertSpaces DefaultToInsertSpaces

Determines the default setting for the Insert spaces option in the Options dialog box for a language service.

DefaultToNonHotURLs DefaultToNonHotURLs DefaultToNonHotURLs DefaultToNonHotURLs DefaultToNonHotURLs

Determines the initial setting of the Enable single-click URL navigation option in the Options dialog box.

EnableAdvancedMembersOption EnableAdvancedMembersOption EnableAdvancedMembersOption EnableAdvancedMembersOption EnableAdvancedMembersOption

Determines whether the Hide Advanced Members option is enabled in the Options dialog box.

EnableAsyncCompletion EnableAsyncCompletion EnableAsyncCompletion EnableAsyncCompletion EnableAsyncCompletion

Determines whether the language supports background parsing.

EnableCommenting EnableCommenting EnableCommenting EnableCommenting EnableCommenting

Determines whether the language service can comment and uncomment source code using a single command.

EnableFormatSelection EnableFormatSelection EnableFormatSelection EnableFormatSelection EnableFormatSelection

Determines if the language service supports automatic formatting of the source code.

EnableLineNumbers EnableLineNumbers EnableLineNumbers EnableLineNumbers EnableLineNumbers

Determines if the Line numbers option can be selected in the Options dialog box.

FontColorDefaults FontColorDefaults FontColorDefaults FontColorDefaults FontColorDefaults
HideAdvancedMembersByDefault HideAdvancedMembersByDefault HideAdvancedMembersByDefault HideAdvancedMembersByDefault HideAdvancedMembersByDefault

Determines the initial state of the Hide Advanced Members option in the Options dialog box.

LanguageName LanguageName LanguageName LanguageName LanguageName

Returns the name of the language.

LanguageResourceID LanguageResourceID LanguageResourceID LanguageResourceID LanguageResourceID

Returns the resource ID used to obtain the localized version of the language name.

LanguageServiceSid LanguageServiceSid LanguageServiceSid LanguageServiceSid LanguageServiceSid
MatchBraces MatchBraces MatchBraces MatchBraces MatchBraces

Determines if the language service supports matching language pairs.

MatchBracesAtCaret MatchBracesAtCaret MatchBracesAtCaret MatchBracesAtCaret MatchBracesAtCaret

Determines if a language service supports matching language pairs while typing.

MaxErrorMessages MaxErrorMessages MaxErrorMessages MaxErrorMessages MaxErrorMessages

Determines the maximum number of errors message that a language service can report for a parsing operation.

QuickInfo QuickInfo QuickInfo QuickInfo QuickInfo

Determines if the language service supports the IntelliSense Quick Info.

RequestStockColors RequestStockColors RequestStockColors RequestStockColors RequestStockColors

Determines if the language service is using the built-in colorable items as supplied by Visual Studio.

ShowCompletion ShowCompletion ShowCompletion ShowCompletion ShowCompletion

Determines if the Statement completion options are enabled in the Options dialog box.

ShowDropDownOptions ShowDropDownOptions ShowDropDownOptions ShowDropDownOptions ShowDropDownOptions

Determines if the Navigation bar option is enabled in the Options dialog box.

ShowHotURLs ShowHotURLs ShowHotURLs ShowHotURLs ShowHotURLs

Determines if URLs are displayed in such a way as to show they can be clicked. This option is not used.

ShowMatchingBrace ShowMatchingBrace ShowMatchingBrace ShowMatchingBrace ShowMatchingBrace

Determines if the matching language pair is shown in the status bar.

ShowSmartIndent ShowSmartIndent ShowSmartIndent ShowSmartIndent ShowSmartIndent

Determines if the Smart Indenting option is enabled in the Options dialog box.

SingleCodeWindowOnly SingleCodeWindowOnly SingleCodeWindowOnly SingleCodeWindowOnly SingleCodeWindowOnly

Determines if the Window -> New Window command is disabled for a language service.

SupportCopyPasteOfHTML SupportCopyPasteOfHTML SupportCopyPasteOfHTML SupportCopyPasteOfHTML SupportCopyPasteOfHTML

Determines if the language service supports the clipboard format HTML for copy and paste operations.

TypeId TypeId TypeId TypeId TypeId

Gets the current instance of this attribute.

(Inherited from RegistrationAttribute)


GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid)

Gets the registry path (relative to the registry root of the application) of the VSPackage.

(Inherited from RegistrationAttribute)
Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext)

Creates all of the registry keys and entries as specified by the class constructor.

Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext)

Removes all of the registry keys and entries as specified by the class constructor.

Applies to