Share via


ProvideLanguageServiceAttribute Constructor

Initializes a new instance of the Shell.ProvideLanguageServiceAttribute class.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)

Syntax

'Declaration
Public Sub New ( _
    languageService As Object, _
    strLanguageName As String, _
    languageResourceID As Integer _
)
public ProvideLanguageServiceAttribute(
    Object languageService,
    string strLanguageName,
    int languageResourceID
)
public:
ProvideLanguageServiceAttribute(
    Object^ languageService, 
    String^ strLanguageName, 
    int languageResourceID
)
new : 
        languageService:Object * 
        strLanguageName:string * 
        languageResourceID:int -> ProvideLanguageServiceAttribute
public function ProvideLanguageServiceAttribute(
    languageService : Object, 
    strLanguageName : String, 
    languageResourceID : int
)

Parameters

  • languageService
    Type: System.Object
    [in] This is either a string containing a GUID or a type representing the class that implements the language service. The language service GUID is derived from this string or type.
  • strLanguageName
    Type: System.String
    [in] The name of the language. This name is used in the registry for registry key and entry names.
  • languageResourceID
    Type: System.Int32
    [in] The resource ID for the localized version of the language name. This is used to present the language name in dialog boxes and other user interface elements.

Remarks

The following registry layout shows where each of the required parameters is used.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[X.Y]\Languages\
  Language Services\
    [strLanguageName]\
      (Default) = reg_sz: [languageService.GUID]
       Package   = reg_sz: [Package GUID]
       LangResID = reg_dword: [languageResourceID]

The [Package GUID] value is automatically obtained from the class that implements the IVsPackage interface in the assembly.

In addition to the required parameters listed in the Parameters section, the constructor also accepts optional named parameters after the required parameters. This is a special form supported only in user-defined attributes. These named parameters correspond to the public properties on this class that have both get and set operators.

Examples

using Microsoft.VisualStudio.Shell;

namespace MyLanguagePackage
{
    internal class MyConstants
    {
        public const string languageName           = "MyLanguage";
        public const int    languageNameResourceID = 106;
    }

    [ProvideLanguageService(typeof(MyLanguageService),           // Required
                            MyConstants.languageName,            // Required
                            MyConstants.languageNameResourceID,  // Required
        // 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
    {
    }
}

.NET Framework Security

See Also

Reference

ProvideLanguageServiceAttribute Class

Microsoft.VisualStudio.Shell Namespace